// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.27.0
// source: settings.sql

package db

import (
	"context"
)

const getAppSetting = `-- name: GetAppSetting :one
SELECT value FROM app_settings WHERE key = $1
`

func (q *Queries) GetAppSetting(ctx context.Context, key string) ([]byte, error) {
	row := q.db.QueryRow(ctx, getAppSetting, key)
	var value []byte
	err := row.Scan(&value)
	return value, err
}

const upsertAppSetting = `-- name: UpsertAppSetting :exec
INSERT INTO app_settings (key, value, updated_at) VALUES ($1, $2, now())
ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = now()
`

type UpsertAppSettingParams struct {
	Key   string `json:"key"`
	Value []byte `json:"value"`
}

func (q *Queries) UpsertAppSetting(ctx context.Context, arg UpsertAppSettingParams) error {
	_, err := q.db.Exec(ctx, upsertAppSetting, arg.Key, arg.Value)
	return err
}
