Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go
978 B
Raw Blame
// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.31.1
// source: site_counter.sql

package db

import (
	"context"
)

const addSiteCounter = `-- name: AddSiteCounter :one
INSERT INTO site_counter (name, value)
VALUES ($1, $2)
ON CONFLICT (name) DO UPDATE
SET value = site_counter.value + EXCLUDED.value, updated_at = now()
RETURNING value
`

type AddSiteCounterParams struct {
	Name  string `json:"name"`
	Value int64  `json:"value"`
}

func (q *Queries) AddSiteCounter(ctx context.Context, arg AddSiteCounterParams) (int64, error) {
	row := q.db.QueryRow(ctx, addSiteCounter, arg.Name, arg.Value)
	var value int64
	err := row.Scan(&value)
	return value, err
}

const getSiteCounter = `-- name: GetSiteCounter :one
SELECT value FROM site_counter WHERE name = $1
`

func (q *Queries) GetSiteCounter(ctx context.Context, name string) (int64, error) {
	row := q.db.QueryRow(ctx, getSiteCounter, name)
	var value int64
	err := row.Scan(&value)
	return value, err
}