v0.10.0 0f4e9eb

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 DeleteHistory = `-- name: DeleteHistory :exec
29DELETE FROM history
30WHERE id = ?
31`
32
33func (q *Queries) DeleteHistory(ctx context.Context, id int64) error {
34	_, err := q.db.ExecContext(ctx, DeleteHistory, id)
35	return err
36}
37
38const GetHistory = `-- name: GetHistory :many
39SELECT id, url, title, visit_count, last_visited, created_at, favicon_url
40FROM history
41ORDER BY last_visited DESC
42LIMIT ?
43`
44
45func (q *Queries) GetHistory(ctx context.Context, limit int64) ([]History, error) {
46	rows, err := q.db.QueryContext(ctx, GetHistory, limit)
47	if err != nil {
48		return nil, err
49	}
50	defer rows.Close()
51	items := []History{}
52	for rows.Next() {
53		var i History
54		if err := rows.Scan(
55			&i.ID,
56			&i.Url,
57			&i.Title,
58			&i.VisitCount,
59			&i.LastVisited,
60			&i.CreatedAt,
61			&i.FaviconUrl,
62		); err != nil {
63			return nil, err
64		}
65		items = append(items, i)
66	}
67	if err := rows.Close(); err != nil {
68		return nil, err
69	}
70	if err := rows.Err(); err != nil {
71		return nil, err
72	}
73	return items, nil
74}
75
76const GetHistoryWithOffset = `-- name: GetHistoryWithOffset :many
77SELECT id, url, title, visit_count, last_visited, created_at, favicon_url
78FROM history
79ORDER BY last_visited DESC
80LIMIT ? OFFSET ?
81`
82
83func (q *Queries) GetHistoryWithOffset(ctx context.Context, limit int64, offset int64) ([]History, error) {
84	rows, err := q.db.QueryContext(ctx, GetHistoryWithOffset, limit, offset)
85	if err != nil {
86		return nil, err
87	}
88	defer rows.Close()
89	items := []History{}
90	for rows.Next() {
91		var i History
92		if err := rows.Scan(
93			&i.ID,
94			&i.Url,
95			&i.Title,
96			&i.VisitCount,
97			&i.LastVisited,
98			&i.CreatedAt,
99			&i.FaviconUrl,
100		); err != nil {
101			return nil, err
102		}
103		items = append(items, i)
104	}
105	if err := rows.Close(); err != nil {
106		return nil, err
107	}
108	if err := rows.Err(); err != nil {
109		return nil, err
110	}
111	return items, nil
112}
113
114const GetShortcuts = `-- name: GetShortcuts :many
115SELECT id, shortcut, url_template, description, created_at
116FROM shortcuts
117ORDER BY shortcut
118`
119
120func (q *Queries) GetShortcuts(ctx context.Context) ([]Shortcut, error) {
121	rows, err := q.db.QueryContext(ctx, GetShortcuts)
122	if err != nil {
123		return nil, err
124	}
125	defer rows.Close()
126	items := []Shortcut{}
127	for rows.Next() {
128		var i Shortcut
129		if err := rows.Scan(
130			&i.ID,
131			&i.Shortcut,
132			&i.UrlTemplate,
133			&i.Description,
134			&i.CreatedAt,
135		); err != nil {
136			return nil, err
137		}
138		items = append(items, i)
139	}
140	if err := rows.Close(); err != nil {
141		return nil, err
142	}
143	if err := rows.Err(); err != nil {
144		return nil, err
145	}
146	return items, nil
147}
148
149const SearchHistory = `-- name: SearchHistory :many
150SELECT id, url, title, visit_count, last_visited, created_at, favicon_url
151FROM history 
152WHERE url LIKE '%' || ? || '%' OR title LIKE '%' || ? || '%'
153ORDER BY visit_count DESC, last_visited DESC
154LIMIT ?
155`
156
157func (q *Queries) SearchHistory(ctx context.Context, column1 sql.NullString, column2 sql.NullString, limit int64) ([]History, error) {
158	rows, err := q.db.QueryContext(ctx, SearchHistory, column1, column2, limit)
159	if err != nil {
160		return nil, err
161	}
162	defer rows.Close()
163	items := []History{}
164	for rows.Next() {
165		var i History
166		if err := rows.Scan(
167			&i.ID,
168			&i.Url,
169			&i.Title,
170			&i.VisitCount,
171			&i.LastVisited,
172			&i.CreatedAt,
173			&i.FaviconUrl,
174		); err != nil {
175			return nil, err
176		}
177		items = append(items, i)
178	}
179	if err := rows.Close(); err != nil {
180		return nil, err
181	}
182	if err := rows.Err(); err != nil {
183		return nil, err
184	}
185	return items, nil
186}
187
188const UpdateHistoryFavicon = `-- name: UpdateHistoryFavicon :exec
189UPDATE history 
190SET favicon_url = ?
191WHERE url = ?
192`
193
194func (q *Queries) UpdateHistoryFavicon(ctx context.Context, faviconUrl sql.NullString, url string) error {
195	_, err := q.db.ExecContext(ctx, UpdateHistoryFavicon, faviconUrl, url)
196	return err
197}

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