-
Notifications
You must be signed in to change notification settings - Fork 0
/
dictionary.sql.go
54 lines (45 loc) · 1.13 KB
/
dictionary.sql.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.26.0
// source: dictionary.sql
package queries
import (
"context"
)
const deleteDictEntry = `-- name: DeleteDictEntry :exec
DELETE FROM dictionary
WHERE key = ?
`
func (q *Queries) DeleteDictEntry(ctx context.Context, key string) error {
_, err := q.db.ExecContext(ctx, deleteDictEntry, key)
return err
}
const getDictEntry = `-- name: GetDictEntry :one
SELECT "key", value
FROM dictionary
WHERE key = ?
`
func (q *Queries) GetDictEntry(ctx context.Context, key string) (Dictionary, error) {
row := q.db.QueryRowContext(ctx, getDictEntry, key)
var i Dictionary
err := row.Scan(&i.Key, &i.Value)
return i, err
}
const updateOrCreateDictEntry = `-- name: UpdateOrCreateDictEntry :exec
INSERT INTO dictionary (
key,
value
)
VALUES (?1, ?2)
ON CONFLICT(key) DO
UPDATE SET value = ?2
WHERE key = ?1
`
type UpdateOrCreateDictEntryParams struct {
Key string
Value []byte
}
func (q *Queries) UpdateOrCreateDictEntry(ctx context.Context, arg UpdateOrCreateDictEntryParams) error {
_, err := q.db.ExecContext(ctx, updateOrCreateDictEntry, arg.Key, arg.Value)
return err
}