v0.6.0 5c50dd3

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, favicon_url
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			&i.FaviconUrl,
52		); err != nil {
53			return nil, err
54		}
55		items = append(items, i)
56	}
57	if err := rows.Close(); err != nil {
58		return nil, err
59	}
60	if err := rows.Err(); err != nil {
61		return nil, err
62	}
63	return items, nil
64}
65
66const GetShortcuts = `-- name: GetShortcuts :many
67SELECT id, shortcut, url_template, description, created_at
68FROM shortcuts
69ORDER BY shortcut
70`
71
72func (q *Queries) GetShortcuts(ctx context.Context) ([]Shortcut, error) {
73	rows, err := q.db.QueryContext(ctx, GetShortcuts)
74	if err != nil {
75		return nil, err
76	}
77	defer rows.Close()
78	items := []Shortcut{}
79	for rows.Next() {
80		var i Shortcut
81		if err := rows.Scan(
82			&i.ID,
83			&i.Shortcut,
84			&i.UrlTemplate,
85			&i.Description,
86			&i.CreatedAt,
87		); err != nil {
88			return nil, err
89		}
90		items = append(items, i)
91	}
92	if err := rows.Close(); err != nil {
93		return nil, err
94	}
95	if err := rows.Err(); err != nil {
96		return nil, err
97	}
98	return items, nil
99}
100
101const SearchHistory = `-- name: SearchHistory :many
102SELECT id, url, title, visit_count, last_visited, created_at, favicon_url
103FROM history 
104WHERE url LIKE '%' || ? || '%' OR title LIKE '%' || ? || '%'
105ORDER BY visit_count DESC, last_visited DESC
106LIMIT ?
107`
108
109func (q *Queries) SearchHistory(ctx context.Context, column1 sql.NullString, column2 sql.NullString, limit int64) ([]History, error) {
110	rows, err := q.db.QueryContext(ctx, SearchHistory, column1, column2, limit)
111	if err != nil {
112		return nil, err
113	}
114	defer rows.Close()
115	items := []History{}
116	for rows.Next() {
117		var i History
118		if err := rows.Scan(
119			&i.ID,
120			&i.Url,
121			&i.Title,
122			&i.VisitCount,
123			&i.LastVisited,
124			&i.CreatedAt,
125			&i.FaviconUrl,
126		); err != nil {
127			return nil, err
128		}
129		items = append(items, i)
130	}
131	if err := rows.Close(); err != nil {
132		return nil, err
133	}
134	if err := rows.Err(); err != nil {
135		return nil, err
136	}
137	return items, nil
138}
139
140const UpdateHistoryFavicon = `-- name: UpdateHistoryFavicon :exec
141UPDATE history 
142SET favicon_url = ?
143WHERE url = ?
144`
145
146func (q *Queries) UpdateHistoryFavicon(ctx context.Context, faviconUrl sql.NullString, url string) error {
147	_, err := q.db.ExecContext(ctx, UpdateHistoryFavicon, faviconUrl, url)
148	return err
149}

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