v0.24.0 a261e52

folders.sql.go RawHistoryFolder

1// Code generated by sqlc. DO NOT EDIT.
2// versions:
3//   sqlc v1.30.0
4// source: folders.sql
5
6package sqlc
7
8import (
9	"context"
10	"database/sql"
11)
12
13const CreateFolder = `-- name: CreateFolder :one
14INSERT INTO favorite_folders (name, icon, parent_id, position, created_at)
15VALUES (?, ?, ?, COALESCE((SELECT MAX(position) + 1 FROM favorite_folders), 0), CURRENT_TIMESTAMP)
16RETURNING id, name, icon, parent_id, position, created_at
17`
18
19type CreateFolderParams struct {
20	Name     string         `json:"name"`
21	Icon     sql.NullString `json:"icon"`
22	ParentID sql.NullInt64  `json:"parent_id"`
23}
24
25func (q *Queries) CreateFolder(ctx context.Context, arg CreateFolderParams) (FavoriteFolder, error) {
26	row := q.db.QueryRowContext(ctx, CreateFolder, arg.Name, arg.Icon, arg.ParentID)
27	var i FavoriteFolder
28	err := row.Scan(
29		&i.ID,
30		&i.Name,
31		&i.Icon,
32		&i.ParentID,
33		&i.Position,
34		&i.CreatedAt,
35	)
36	return i, err
37}
38
39const DeleteFolder = `-- name: DeleteFolder :exec
40DELETE FROM favorite_folders WHERE id = ?
41`
42
43func (q *Queries) DeleteFolder(ctx context.Context, id int64) error {
44	_, err := q.db.ExecContext(ctx, DeleteFolder, id)
45	return err
46}
47
48const GetAllFolders = `-- name: GetAllFolders :many
49SELECT id, name, icon, parent_id, position, created_at FROM favorite_folders ORDER BY position ASC
50`
51
52func (q *Queries) GetAllFolders(ctx context.Context) ([]FavoriteFolder, error) {
53	rows, err := q.db.QueryContext(ctx, GetAllFolders)
54	if err != nil {
55		return nil, err
56	}
57	defer rows.Close()
58	items := []FavoriteFolder{}
59	for rows.Next() {
60		var i FavoriteFolder
61		if err := rows.Scan(
62			&i.ID,
63			&i.Name,
64			&i.Icon,
65			&i.ParentID,
66			&i.Position,
67			&i.CreatedAt,
68		); err != nil {
69			return nil, err
70		}
71		items = append(items, i)
72	}
73	if err := rows.Close(); err != nil {
74		return nil, err
75	}
76	if err := rows.Err(); err != nil {
77		return nil, err
78	}
79	return items, nil
80}
81
82const GetChildFolders = `-- name: GetChildFolders :many
83SELECT id, name, icon, parent_id, position, created_at FROM favorite_folders WHERE parent_id = ? ORDER BY position ASC
84`
85
86func (q *Queries) GetChildFolders(ctx context.Context, parentID sql.NullInt64) ([]FavoriteFolder, error) {
87	rows, err := q.db.QueryContext(ctx, GetChildFolders, parentID)
88	if err != nil {
89		return nil, err
90	}
91	defer rows.Close()
92	items := []FavoriteFolder{}
93	for rows.Next() {
94		var i FavoriteFolder
95		if err := rows.Scan(
96			&i.ID,
97			&i.Name,
98			&i.Icon,
99			&i.ParentID,
100			&i.Position,
101			&i.CreatedAt,
102		); err != nil {
103			return nil, err
104		}
105		items = append(items, i)
106	}
107	if err := rows.Close(); err != nil {
108		return nil, err
109	}
110	if err := rows.Err(); err != nil {
111		return nil, err
112	}
113	return items, nil
114}
115
116const GetFolderByID = `-- name: GetFolderByID :one
117SELECT id, name, icon, parent_id, position, created_at FROM favorite_folders WHERE id = ? LIMIT 1
118`
119
120func (q *Queries) GetFolderByID(ctx context.Context, id int64) (FavoriteFolder, error) {
121	row := q.db.QueryRowContext(ctx, GetFolderByID, id)
122	var i FavoriteFolder
123	err := row.Scan(
124		&i.ID,
125		&i.Name,
126		&i.Icon,
127		&i.ParentID,
128		&i.Position,
129		&i.CreatedAt,
130	)
131	return i, err
132}
133
134const GetRootFolders = `-- name: GetRootFolders :many
135SELECT id, name, icon, parent_id, position, created_at FROM favorite_folders WHERE parent_id IS NULL ORDER BY position ASC
136`
137
138func (q *Queries) GetRootFolders(ctx context.Context) ([]FavoriteFolder, error) {
139	rows, err := q.db.QueryContext(ctx, GetRootFolders)
140	if err != nil {
141		return nil, err
142	}
143	defer rows.Close()
144	items := []FavoriteFolder{}
145	for rows.Next() {
146		var i FavoriteFolder
147		if err := rows.Scan(
148			&i.ID,
149			&i.Name,
150			&i.Icon,
151			&i.ParentID,
152			&i.Position,
153			&i.CreatedAt,
154		); err != nil {
155			return nil, err
156		}
157		items = append(items, i)
158	}
159	if err := rows.Close(); err != nil {
160		return nil, err
161	}
162	if err := rows.Err(); err != nil {
163		return nil, err
164	}
165	return items, nil
166}
167
168const UpdateFolder = `-- name: UpdateFolder :exec
169UPDATE favorite_folders SET name = ?, icon = ? WHERE id = ?
170`
171
172type UpdateFolderParams struct {
173	Name string         `json:"name"`
174	Icon sql.NullString `json:"icon"`
175	ID   int64          `json:"id"`
176}
177
178func (q *Queries) UpdateFolder(ctx context.Context, arg UpdateFolderParams) error {
179	_, err := q.db.ExecContext(ctx, UpdateFolder, arg.Name, arg.Icon, arg.ID)
180	return err
181}
182
183const UpdateFolderPosition = `-- name: UpdateFolderPosition :exec
184UPDATE favorite_folders SET position = ? WHERE id = ?
185`
186
187type UpdateFolderPositionParams struct {
188	Position int64 `json:"position"`
189	ID       int64 `json:"id"`
190}
191
192func (q *Queries) UpdateFolderPosition(ctx context.Context, arg UpdateFolderPositionParams) error {
193	_, err := q.db.ExecContext(ctx, UpdateFolderPosition, arg.Position, arg.ID)
194	return err
195}

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