permissions.sql.go RawHistoryFolder

1// Code generated by sqlc. DO NOT EDIT.
2// versions:
3//   sqlc v1.30.0
4// source: permissions.sql
5
6package sqlc
7
8import (
9	"context"
10)
11
12const DeletePermission = `-- name: DeletePermission :exec
13DELETE FROM permissions WHERE origin = ? AND permission_type = ?
14`
15
16type DeletePermissionParams struct {
17	Origin         string `json:"origin"`
18	PermissionType string `json:"permission_type"`
19}
20
21func (q *Queries) DeletePermission(ctx context.Context, arg DeletePermissionParams) error {
22	_, err := q.db.ExecContext(ctx, DeletePermission, arg.Origin, arg.PermissionType)
23	return err
24}
25
26const GetPermission = `-- name: GetPermission :one
27SELECT origin, permission_type, decision, updated_at FROM permissions WHERE origin = ? AND permission_type = ? LIMIT 1
28`
29
30type GetPermissionParams struct {
31	Origin         string `json:"origin"`
32	PermissionType string `json:"permission_type"`
33}
34
35func (q *Queries) GetPermission(ctx context.Context, arg GetPermissionParams) (Permission, error) {
36	row := q.db.QueryRowContext(ctx, GetPermission, arg.Origin, arg.PermissionType)
37	var i Permission
38	err := row.Scan(
39		&i.Origin,
40		&i.PermissionType,
41		&i.Decision,
42		&i.UpdatedAt,
43	)
44	return i, err
45}
46
47const ListAllPermissions = `-- name: ListAllPermissions :many
48SELECT origin, permission_type, decision, updated_at FROM permissions ORDER BY origin, permission_type
49`
50
51func (q *Queries) ListAllPermissions(ctx context.Context) ([]Permission, error) {
52	rows, err := q.db.QueryContext(ctx, ListAllPermissions)
53	if err != nil {
54		return nil, err
55	}
56	defer rows.Close()
57	items := []Permission{}
58	for rows.Next() {
59		var i Permission
60		if err := rows.Scan(
61			&i.Origin,
62			&i.PermissionType,
63			&i.Decision,
64			&i.UpdatedAt,
65		); err != nil {
66			return nil, err
67		}
68		items = append(items, i)
69	}
70	if err := rows.Close(); err != nil {
71		return nil, err
72	}
73	if err := rows.Err(); err != nil {
74		return nil, err
75	}
76	return items, nil
77}
78
79const ListPermissionsByOrigin = `-- name: ListPermissionsByOrigin :many
80SELECT origin, permission_type, decision, updated_at FROM permissions WHERE origin = ? ORDER BY updated_at DESC
81`
82
83func (q *Queries) ListPermissionsByOrigin(ctx context.Context, origin string) ([]Permission, error) {
84	rows, err := q.db.QueryContext(ctx, ListPermissionsByOrigin, origin)
85	if err != nil {
86		return nil, err
87	}
88	defer rows.Close()
89	items := []Permission{}
90	for rows.Next() {
91		var i Permission
92		if err := rows.Scan(
93			&i.Origin,
94			&i.PermissionType,
95			&i.Decision,
96			&i.UpdatedAt,
97		); err != nil {
98			return nil, err
99		}
100		items = append(items, i)
101	}
102	if err := rows.Close(); err != nil {
103		return nil, err
104	}
105	if err := rows.Err(); err != nil {
106		return nil, err
107	}
108	return items, nil
109}
110
111const SetPermission = `-- name: SetPermission :exec
112INSERT INTO permissions (origin, permission_type, decision, updated_at)
113VALUES (?, ?, ?, CURRENT_TIMESTAMP)
114ON CONFLICT(origin, permission_type) DO UPDATE SET
115    decision = excluded.decision,
116    updated_at = CURRENT_TIMESTAMP
117`
118
119type SetPermissionParams struct {
120	Origin         string `json:"origin"`
121	PermissionType string `json:"permission_type"`
122	Decision       string `json:"decision"`
123}
124
125func (q *Queries) SetPermission(ctx context.Context, arg SetPermissionParams) error {
126	_, err := q.db.ExecContext(ctx, SetPermission, arg.Origin, arg.PermissionType, arg.Decision)
127	return err
128}

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