settings.sql.go 839 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Code generated by sqlc. DO NOT EDIT.
  2. // versions:
  3. // sqlc v1.30.0
  4. // source: settings.sql
  5. package queries
  6. import (
  7. "context"
  8. )
  9. const getSetting = `-- name: GetSetting :one
  10. SELECT value FROM settings WHERE key = ?
  11. `
  12. func (q *Queries) GetSetting(ctx context.Context, key string) (string, error) {
  13. row := q.db.QueryRowContext(ctx, getSetting, key)
  14. var value string
  15. err := row.Scan(&value)
  16. return value, err
  17. }
  18. const upsertSetting = `-- name: UpsertSetting :exec
  19. INSERT INTO settings (key, value) VALUES (?, ?)
  20. ON CONFLICT(key) DO UPDATE SET value = excluded.value
  21. `
  22. type UpsertSettingParams struct {
  23. Key string `json:"key"`
  24. Value string `json:"value"`
  25. }
  26. func (q *Queries) UpsertSetting(ctx context.Context, arg UpsertSettingParams) error {
  27. _, err := q.db.ExecContext(ctx, upsertSetting, arg.Key, arg.Value)
  28. return err
  29. }