v0.4.0 6203a22

history.sql.go RawHistoryFolder

1// Code generated by sqlc. DO NOT EDIT.
2// versions:
3//   sqlc v1.30.0
4// source: history.sql
5
6package db
7
8import (
9	"context"
10	"database/sql"
11)
12
13const AddOrUpdateHistory = `-- name: AddOrUpdateHistory :exec
14INSERT INTO history (url, title) 
15VALUES (?, ?)
16ON CONFLICT(url) 
17DO UPDATE SET 
18    visit_count = visit_count + 1,
19    last_visited = CURRENT_TIMESTAMP,
20    title = EXCLUDED.title
21`
22
23func (q *Queries) AddOrUpdateHistory(ctx context.Context, url string, title sql.NullString) error {
24	_, err := q.db.ExecContext(ctx, AddOrUpdateHistory, url, title)
25	return err
26}
27
28const GetHistory = `-- name: GetHistory :many
29SELECT id, url, title, visit_count, last_visited, created_at
30FROM history
31ORDER BY last_visited DESC
32LIMIT ?
33`
34
35func (q *Queries) GetHistory(ctx context.Context, limit int64) ([]History, error) {
36	rows, err := q.db.QueryContext(ctx, GetHistory, limit)
37	if err != nil {
38		return nil, err
39	}
40	defer rows.Close()
41	items := []History{}
42	for rows.Next() {
43		var i History
44		if err := rows.Scan(
45			&i.ID,
46			&i.Url,
47			&i.Title,
48			&i.VisitCount,
49			&i.LastVisited,
50			&i.CreatedAt,
51		); err != nil {
52			return nil, err
53		}
54		items = append(items, i)
55	}
56	if err := rows.Close(); err != nil {
57		return nil, err
58	}
59	if err := rows.Err(); err != nil {
60		return nil, err
61	}
62	return items, nil
63}
64
65const GetShortcuts = `-- name: GetShortcuts :many
66SELECT id, shortcut, url_template, description, created_at
67FROM shortcuts
68ORDER BY shortcut
69`
70
71func (q *Queries) GetShortcuts(ctx context.Context) ([]Shortcut, error) {
72	rows, err := q.db.QueryContext(ctx, GetShortcuts)
73	if err != nil {
74		return nil, err
75	}
76	defer rows.Close()
77	items := []Shortcut{}
78	for rows.Next() {
79		var i Shortcut
80		if err := rows.Scan(
81			&i.ID,
82			&i.Shortcut,
83			&i.UrlTemplate,
84			&i.Description,
85			&i.CreatedAt,
86		); err != nil {
87			return nil, err
88		}
89		items = append(items, i)
90	}
91	if err := rows.Close(); err != nil {
92		return nil, err
93	}
94	if err := rows.Err(); err != nil {
95		return nil, err
96	}
97	return items, nil
98}
99
100const SearchHistory = `-- name: SearchHistory :many
101SELECT id, url, title, visit_count, last_visited, created_at
102FROM history 
103WHERE url LIKE '%' || ? || '%' OR title LIKE '%' || ? || '%'
104ORDER BY visit_count DESC, last_visited DESC
105LIMIT ?
106`
107
108func (q *Queries) SearchHistory(ctx context.Context, column1 sql.NullString, column2 sql.NullString, limit int64) ([]History, error) {
109	rows, err := q.db.QueryContext(ctx, SearchHistory, column1, column2, limit)
110	if err != nil {
111		return nil, err
112	}
113	defer rows.Close()
114	items := []History{}
115	for rows.Next() {
116		var i History
117		if err := rows.Scan(
118			&i.ID,
119			&i.Url,
120			&i.Title,
121			&i.VisitCount,
122			&i.LastVisited,
123			&i.CreatedAt,
124		); err != nil {
125			return nil, err
126		}
127		items = append(items, i)
128	}
129	if err := rows.Close(); err != nil {
130		return nil, err
131	}
132	if err := rows.Err(); err != nil {
133		return nil, err
134	}
135	return items, nil
136}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close