v0.20.1 d9a391f

favorites.sql.go RawHistoryFolder

1// Code generated by sqlc. DO NOT EDIT.
2// versions:
3//   sqlc v1.30.0
4// source: favorites.sql
5
6package sqlc
7
8import (
9	"context"
10	"database/sql"
11)
12
13const CreateFavorite = `-- name: CreateFavorite :one
14INSERT INTO favorites (url, title, favicon_url, folder_id, position, created_at, updated_at)
15VALUES (?, ?, ?, ?, COALESCE((SELECT MAX(position) + 1 FROM favorites), 0), CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
16RETURNING id, url, title, favicon_url, folder_id, shortcut_key, position, created_at, updated_at
17`
18
19type CreateFavoriteParams struct {
20	Url        string         `json:"url"`
21	Title      sql.NullString `json:"title"`
22	FaviconUrl sql.NullString `json:"favicon_url"`
23	FolderID   sql.NullInt64  `json:"folder_id"`
24}
25
26func (q *Queries) CreateFavorite(ctx context.Context, arg CreateFavoriteParams) (Favorite, error) {
27	row := q.db.QueryRowContext(ctx, CreateFavorite,
28		arg.Url,
29		arg.Title,
30		arg.FaviconUrl,
31		arg.FolderID,
32	)
33	var i Favorite
34	err := row.Scan(
35		&i.ID,
36		&i.Url,
37		&i.Title,
38		&i.FaviconUrl,
39		&i.FolderID,
40		&i.ShortcutKey,
41		&i.Position,
42		&i.CreatedAt,
43		&i.UpdatedAt,
44	)
45	return i, err
46}
47
48const DeleteFavorite = `-- name: DeleteFavorite :exec
49DELETE FROM favorites WHERE id = ?
50`
51
52func (q *Queries) DeleteFavorite(ctx context.Context, id int64) error {
53	_, err := q.db.ExecContext(ctx, DeleteFavorite, id)
54	return err
55}
56
57const GetAllFavorites = `-- name: GetAllFavorites :many
58SELECT id, url, title, favicon_url, folder_id, shortcut_key, position, created_at, updated_at FROM favorites ORDER BY position ASC
59`
60
61func (q *Queries) GetAllFavorites(ctx context.Context) ([]Favorite, error) {
62	rows, err := q.db.QueryContext(ctx, GetAllFavorites)
63	if err != nil {
64		return nil, err
65	}
66	defer rows.Close()
67	items := []Favorite{}
68	for rows.Next() {
69		var i Favorite
70		if err := rows.Scan(
71			&i.ID,
72			&i.Url,
73			&i.Title,
74			&i.FaviconUrl,
75			&i.FolderID,
76			&i.ShortcutKey,
77			&i.Position,
78			&i.CreatedAt,
79			&i.UpdatedAt,
80		); err != nil {
81			return nil, err
82		}
83		items = append(items, i)
84	}
85	if err := rows.Close(); err != nil {
86		return nil, err
87	}
88	if err := rows.Err(); err != nil {
89		return nil, err
90	}
91	return items, nil
92}
93
94const GetFavoriteByID = `-- name: GetFavoriteByID :one
95SELECT id, url, title, favicon_url, folder_id, shortcut_key, position, created_at, updated_at FROM favorites WHERE id = ? LIMIT 1
96`
97
98func (q *Queries) GetFavoriteByID(ctx context.Context, id int64) (Favorite, error) {
99	row := q.db.QueryRowContext(ctx, GetFavoriteByID, id)
100	var i Favorite
101	err := row.Scan(
102		&i.ID,
103		&i.Url,
104		&i.Title,
105		&i.FaviconUrl,
106		&i.FolderID,
107		&i.ShortcutKey,
108		&i.Position,
109		&i.CreatedAt,
110		&i.UpdatedAt,
111	)
112	return i, err
113}
114
115const GetFavoriteByShortcut = `-- name: GetFavoriteByShortcut :one
116SELECT id, url, title, favicon_url, folder_id, shortcut_key, position, created_at, updated_at FROM favorites WHERE shortcut_key = ? LIMIT 1
117`
118
119func (q *Queries) GetFavoriteByShortcut(ctx context.Context, shortcutKey sql.NullInt64) (Favorite, error) {
120	row := q.db.QueryRowContext(ctx, GetFavoriteByShortcut, shortcutKey)
121	var i Favorite
122	err := row.Scan(
123		&i.ID,
124		&i.Url,
125		&i.Title,
126		&i.FaviconUrl,
127		&i.FolderID,
128		&i.ShortcutKey,
129		&i.Position,
130		&i.CreatedAt,
131		&i.UpdatedAt,
132	)
133	return i, err
134}
135
136const GetFavoriteByURL = `-- name: GetFavoriteByURL :one
137SELECT id, url, title, favicon_url, folder_id, shortcut_key, position, created_at, updated_at FROM favorites WHERE url = ? LIMIT 1
138`
139
140func (q *Queries) GetFavoriteByURL(ctx context.Context, url string) (Favorite, error) {
141	row := q.db.QueryRowContext(ctx, GetFavoriteByURL, url)
142	var i Favorite
143	err := row.Scan(
144		&i.ID,
145		&i.Url,
146		&i.Title,
147		&i.FaviconUrl,
148		&i.FolderID,
149		&i.ShortcutKey,
150		&i.Position,
151		&i.CreatedAt,
152		&i.UpdatedAt,
153	)
154	return i, err
155}
156
157const GetFavoritesByFolder = `-- name: GetFavoritesByFolder :many
158SELECT id, url, title, favicon_url, folder_id, shortcut_key, position, created_at, updated_at FROM favorites WHERE folder_id = ? ORDER BY position ASC
159`
160
161func (q *Queries) GetFavoritesByFolder(ctx context.Context, folderID sql.NullInt64) ([]Favorite, error) {
162	rows, err := q.db.QueryContext(ctx, GetFavoritesByFolder, folderID)
163	if err != nil {
164		return nil, err
165	}
166	defer rows.Close()
167	items := []Favorite{}
168	for rows.Next() {
169		var i Favorite
170		if err := rows.Scan(
171			&i.ID,
172			&i.Url,
173			&i.Title,
174			&i.FaviconUrl,
175			&i.FolderID,
176			&i.ShortcutKey,
177			&i.Position,
178			&i.CreatedAt,
179			&i.UpdatedAt,
180		); err != nil {
181			return nil, err
182		}
183		items = append(items, i)
184	}
185	if err := rows.Close(); err != nil {
186		return nil, err
187	}
188	if err := rows.Err(); err != nil {
189		return nil, err
190	}
191	return items, nil
192}
193
194const GetFavoritesWithoutFolder = `-- name: GetFavoritesWithoutFolder :many
195SELECT id, url, title, favicon_url, folder_id, shortcut_key, position, created_at, updated_at FROM favorites WHERE folder_id IS NULL ORDER BY position ASC
196`
197
198func (q *Queries) GetFavoritesWithoutFolder(ctx context.Context) ([]Favorite, error) {
199	rows, err := q.db.QueryContext(ctx, GetFavoritesWithoutFolder)
200	if err != nil {
201		return nil, err
202	}
203	defer rows.Close()
204	items := []Favorite{}
205	for rows.Next() {
206		var i Favorite
207		if err := rows.Scan(
208			&i.ID,
209			&i.Url,
210			&i.Title,
211			&i.FaviconUrl,
212			&i.FolderID,
213			&i.ShortcutKey,
214			&i.Position,
215			&i.CreatedAt,
216			&i.UpdatedAt,
217		); err != nil {
218			return nil, err
219		}
220		items = append(items, i)
221	}
222	if err := rows.Close(); err != nil {
223		return nil, err
224	}
225	if err := rows.Err(); err != nil {
226		return nil, err
227	}
228	return items, nil
229}
230
231const SetFavoriteFolder = `-- name: SetFavoriteFolder :exec
232UPDATE favorites SET folder_id = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?
233`
234
235type SetFavoriteFolderParams struct {
236	FolderID sql.NullInt64 `json:"folder_id"`
237	ID       int64         `json:"id"`
238}
239
240func (q *Queries) SetFavoriteFolder(ctx context.Context, arg SetFavoriteFolderParams) error {
241	_, err := q.db.ExecContext(ctx, SetFavoriteFolder, arg.FolderID, arg.ID)
242	return err
243}
244
245const SetFavoriteShortcut = `-- name: SetFavoriteShortcut :exec
246UPDATE favorites SET shortcut_key = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?
247`
248
249type SetFavoriteShortcutParams struct {
250	ShortcutKey sql.NullInt64 `json:"shortcut_key"`
251	ID          int64         `json:"id"`
252}
253
254func (q *Queries) SetFavoriteShortcut(ctx context.Context, arg SetFavoriteShortcutParams) error {
255	_, err := q.db.ExecContext(ctx, SetFavoriteShortcut, arg.ShortcutKey, arg.ID)
256	return err
257}
258
259const UpdateFavorite = `-- name: UpdateFavorite :exec
260UPDATE favorites
261SET title = ?, favicon_url = ?, updated_at = CURRENT_TIMESTAMP
262WHERE id = ?
263`
264
265type UpdateFavoriteParams struct {
266	Title      sql.NullString `json:"title"`
267	FaviconUrl sql.NullString `json:"favicon_url"`
268	ID         int64          `json:"id"`
269}
270
271func (q *Queries) UpdateFavorite(ctx context.Context, arg UpdateFavoriteParams) error {
272	_, err := q.db.ExecContext(ctx, UpdateFavorite, arg.Title, arg.FaviconUrl, arg.ID)
273	return err
274}
275
276const UpdateFavoritePosition = `-- name: UpdateFavoritePosition :exec
277UPDATE favorites SET position = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?
278`
279
280type UpdateFavoritePositionParams struct {
281	Position int64 `json:"position"`
282	ID       int64 `json:"id"`
283}
284
285func (q *Queries) UpdateFavoritePosition(ctx context.Context, arg UpdateFavoritePositionParams) error {
286	_, err := q.db.ExecContext(ctx, UpdateFavoritePosition, arg.Position, arg.ID)
287	return err
288}

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