// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.30.0
// source: tagging_candidates.sql

package sqlcgen

import (
	"context"
)

const deleteTaggingCandidates = `-- name: DeleteTaggingCandidates :exec
DELETE FROM tagging_candidates
WHERE group_key = ?
`

func (q *Queries) DeleteTaggingCandidates(ctx context.Context, groupKey string) error {
	_, err := q.db.ExecContext(ctx, deleteTaggingCandidates, groupKey)
	return err
}

const getTaggingCandidates = `-- name: GetTaggingCandidates :one
SELECT candidates FROM tagging_candidates
WHERE group_key = ?
LIMIT 1
`

func (q *Queries) GetTaggingCandidates(ctx context.Context, groupKey string) (string, error) {
	row := q.db.QueryRowContext(ctx, getTaggingCandidates, groupKey)
	var candidates string
	err := row.Scan(&candidates)
	return candidates, err
}

const upsertTaggingCandidates = `-- name: UpsertTaggingCandidates :exec
INSERT INTO tagging_candidates (group_key, candidates, computed_at)
VALUES (?, ?, CURRENT_TIMESTAMP)
ON CONFLICT(group_key) DO UPDATE SET
  candidates = excluded.candidates,
  computed_at = excluded.computed_at
`

type UpsertTaggingCandidatesParams struct {
	GroupKey   string
	Candidates string
}

func (q *Queries) UpsertTaggingCandidates(ctx context.Context, arg UpsertTaggingCandidatesParams) error {
	_, err := q.db.ExecContext(ctx, upsertTaggingCandidates, arg.GroupKey, arg.Candidates)
	return err
}
