1// Code generated by sqlc. DO NOT EDIT.
2// versions:
3// sqlc v1.30.0
4// source: favicon.sql
5
6package sqlc
7
8import (
9 "context"
10 "database/sql"
11 "time"
12)
13
14const DeleteFavicon = `-- name: DeleteFavicon :exec
15DELETE FROM favicons WHERE key = ?
16`
17
18func (q *Queries) DeleteFavicon(ctx context.Context, key string) error {
19 _, err := q.db.ExecContext(ctx, DeleteFavicon, key)
20 return err
21}
22
23const GetFavicon = `-- name: GetFavicon :one
24SELECT "key", source_url, page_url, source, content_hash, content_type, updated_at, last_checked_at FROM favicons WHERE key = ? LIMIT 1
25`
26
27func (q *Queries) GetFavicon(ctx context.Context, key string) (Favicon, error) {
28 row := q.db.QueryRowContext(ctx, GetFavicon, key)
29 var i Favicon
30 err := row.Scan(
31 &i.Key,
32 &i.SourceUrl,
33 &i.PageUrl,
34 &i.Source,
35 &i.ContentHash,
36 &i.ContentType,
37 &i.UpdatedAt,
38 &i.LastCheckedAt,
39 )
40 return i, err
41}
42
43const UpdateFaviconLastChecked = `-- name: UpdateFaviconLastChecked :exec
44UPDATE favicons
45SET content_hash = ?, last_checked_at = ?
46WHERE key = ?
47`
48
49type UpdateFaviconLastCheckedParams struct {
50 ContentHash string `json:"content_hash"`
51 LastCheckedAt time.Time `json:"last_checked_at"`
52 Key string `json:"key"`
53}
54
55func (q *Queries) UpdateFaviconLastChecked(ctx context.Context, arg UpdateFaviconLastCheckedParams) error {
56 _, err := q.db.ExecContext(ctx, UpdateFaviconLastChecked, arg.ContentHash, arg.LastCheckedAt, arg.Key)
57 return err
58}
59
60const UpsertFavicon = `-- name: UpsertFavicon :exec
61INSERT INTO favicons (
62 key,
63 source_url,
64 page_url,
65 source,
66 content_hash,
67 content_type,
68 updated_at,
69 last_checked_at
70)
71VALUES (?, ?, ?, ?, ?, ?, ?, ?)
72ON CONFLICT(key) DO UPDATE SET
73 source_url = EXCLUDED.source_url,
74 page_url = EXCLUDED.page_url,
75 source = EXCLUDED.source,
76 content_hash = EXCLUDED.content_hash,
77 content_type = EXCLUDED.content_type,
78 updated_at = EXCLUDED.updated_at,
79 last_checked_at = EXCLUDED.last_checked_at
80`
81
82type UpsertFaviconParams struct {
83 Key string `json:"key"`
84 SourceUrl sql.NullString `json:"source_url"`
85 PageUrl sql.NullString `json:"page_url"`
86 Source string `json:"source"`
87 ContentHash string `json:"content_hash"`
88 ContentType sql.NullString `json:"content_type"`
89 UpdatedAt time.Time `json:"updated_at"`
90 LastCheckedAt time.Time `json:"last_checked_at"`
91}
92
93func (q *Queries) UpsertFavicon(ctx context.Context, arg UpsertFaviconParams) error {
94 _, err := q.db.ExecContext(ctx, UpsertFavicon,
95 arg.Key,
96 arg.SourceUrl,
97 arg.PageUrl,
98 arg.Source,
99 arg.ContentHash,
100 arg.ContentType,
101 arg.UpdatedAt,
102 arg.LastCheckedAt,
103 )
104 return err
105}