v0.14.1 0da30ba

certificate_validations.sql.go RawHistoryFolder

1// Code generated by sqlc. DO NOT EDIT.
2// versions:
3//   sqlc v1.30.0
4// source: certificate_validations.sql
5
6package db
7
8import (
9	"context"
10	"database/sql"
11)
12
13const DeleteCertificateValidation = `-- name: DeleteCertificateValidation :exec
14DELETE FROM certificate_validations
15WHERE hostname = ? AND certificate_hash = ?
16`
17
18func (q *Queries) DeleteCertificateValidation(ctx context.Context, hostname string, certificateHash string) error {
19	_, err := q.db.ExecContext(ctx, DeleteCertificateValidation, hostname, certificateHash)
20	return err
21}
22
23const DeleteExpiredCertificateValidations = `-- name: DeleteExpiredCertificateValidations :exec
24DELETE FROM certificate_validations 
25WHERE expires_at IS NOT NULL AND expires_at <= datetime('now')
26`
27
28func (q *Queries) DeleteExpiredCertificateValidations(ctx context.Context) error {
29	_, err := q.db.ExecContext(ctx, DeleteExpiredCertificateValidations)
30	return err
31}
32
33const GetCertificateValidation = `-- name: GetCertificateValidation :one
34SELECT id, hostname, certificate_hash, user_decision, created_at, expires_at FROM certificate_validations
35WHERE hostname = ? AND certificate_hash = ?
36AND (expires_at IS NULL OR expires_at > datetime('now'))
37LIMIT 1
38`
39
40func (q *Queries) GetCertificateValidation(ctx context.Context, hostname string, certificateHash string) (CertificateValidation, error) {
41	row := q.db.QueryRowContext(ctx, GetCertificateValidation, hostname, certificateHash)
42	var i CertificateValidation
43	err := row.Scan(
44		&i.ID,
45		&i.Hostname,
46		&i.CertificateHash,
47		&i.UserDecision,
48		&i.CreatedAt,
49		&i.ExpiresAt,
50	)
51	return i, err
52}
53
54const GetCertificateValidationByHostname = `-- name: GetCertificateValidationByHostname :one
55SELECT id, hostname, certificate_hash, user_decision, created_at, expires_at FROM certificate_validations
56WHERE hostname = ?
57AND (expires_at IS NULL OR expires_at > datetime('now'))
58ORDER BY created_at DESC
59LIMIT 1
60`
61
62func (q *Queries) GetCertificateValidationByHostname(ctx context.Context, hostname string) (CertificateValidation, error) {
63	row := q.db.QueryRowContext(ctx, GetCertificateValidationByHostname, hostname)
64	var i CertificateValidation
65	err := row.Scan(
66		&i.ID,
67		&i.Hostname,
68		&i.CertificateHash,
69		&i.UserDecision,
70		&i.CreatedAt,
71		&i.ExpiresAt,
72	)
73	return i, err
74}
75
76const ListCertificateValidations = `-- name: ListCertificateValidations :many
77SELECT id, hostname, certificate_hash, user_decision, created_at, expires_at FROM certificate_validations
78WHERE (expires_at IS NULL OR expires_at > datetime('now'))
79ORDER BY hostname
80`
81
82func (q *Queries) ListCertificateValidations(ctx context.Context) ([]CertificateValidation, error) {
83	rows, err := q.db.QueryContext(ctx, ListCertificateValidations)
84	if err != nil {
85		return nil, err
86	}
87	defer rows.Close()
88	items := []CertificateValidation{}
89	for rows.Next() {
90		var i CertificateValidation
91		if err := rows.Scan(
92			&i.ID,
93			&i.Hostname,
94			&i.CertificateHash,
95			&i.UserDecision,
96			&i.CreatedAt,
97			&i.ExpiresAt,
98		); err != nil {
99			return nil, err
100		}
101		items = append(items, i)
102	}
103	if err := rows.Close(); err != nil {
104		return nil, err
105	}
106	if err := rows.Err(); err != nil {
107		return nil, err
108	}
109	return items, nil
110}
111
112const StoreCertificateValidation = `-- name: StoreCertificateValidation :exec
113INSERT OR REPLACE INTO certificate_validations (hostname, certificate_hash, user_decision, expires_at)
114VALUES (?, ?, ?, ?)
115`
116
117func (q *Queries) StoreCertificateValidation(ctx context.Context, hostname string, certificateHash string, userDecision string, expiresAt sql.NullTime) error {
118	_, err := q.db.ExecContext(ctx, StoreCertificateValidation,
119		hostname,
120		certificateHash,
121		userDecision,
122		expiresAt,
123	)
124	return err
125}

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