// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.31.1 // source: settings.sql package sqlcdb import ( "context" "github.com/google/uuid" ) const deleteAppSetting = `-- name: DeleteAppSetting :exec DELETE FROM app_settings WHERE key = $1 ` func (q *Queries) DeleteAppSetting(ctx context.Context, key string) error { _, err := q.db.ExecContext(ctx, deleteAppSetting, key) return err } const getAppSetting = `-- name: GetAppSetting :one SELECT value FROM app_settings WHERE key = $1 ` func (q *Queries) GetAppSetting(ctx context.Context, key string) (string, error) { row := q.db.QueryRowContext(ctx, getAppSetting, key) var value string err := row.Scan(&value) return value, err } const getUserIsAdmin = `-- name: GetUserIsAdmin :one SELECT is_admin FROM users WHERE id = $1 ` func (q *Queries) GetUserIsAdmin(ctx context.Context, id uuid.UUID) (bool, error) { row := q.db.QueryRowContext(ctx, getUserIsAdmin, id) var is_admin bool err := row.Scan(&is_admin) return is_admin, err } const listAdminUserIDs = `-- name: ListAdminUserIDs :many SELECT id FROM users WHERE is_admin ` func (q *Queries) ListAdminUserIDs(ctx context.Context) ([]uuid.UUID, error) { rows, err := q.db.QueryContext(ctx, listAdminUserIDs) if err != nil { return nil, err } defer rows.Close() items := []uuid.UUID{} for rows.Next() { var id uuid.UUID if err := rows.Scan(&id); err != nil { return nil, err } items = append(items, id) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const upsertAppSetting = `-- name: UpsertAppSetting :exec INSERT INTO app_settings (key, value, is_secret, updated_at) VALUES ($1, $2, $3, NOW()) ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, is_secret = EXCLUDED.is_secret, updated_at = NOW() ` type UpsertAppSettingParams struct { Key string `json:"key"` Value string `json:"value"` IsSecret bool `json:"is_secret"` } func (q *Queries) UpsertAppSetting(ctx context.Context, arg UpsertAppSettingParams) error { _, err := q.db.ExecContext(ctx, upsertAppSetting, arg.Key, arg.Value, arg.IsSecret) return err } const upsertAppSettingValue = `-- name: UpsertAppSettingValue :exec INSERT INTO app_settings (key, value, updated_at) VALUES ($1, $2, NOW()) ON CONFLICT (key) DO UPDATE SET value = $2, updated_at = NOW() ` type UpsertAppSettingValueParams struct { Key string `json:"key"` Value string `json:"value"` } func (q *Queries) UpsertAppSettingValue(ctx context.Context, arg UpsertAppSettingValueParams) error { _, err := q.db.ExecContext(ctx, upsertAppSettingValue, arg.Key, arg.Value) return err }