GraphQL API and utilities for the rpdata project
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
// Code generated by sqlc. DO NOT EDIT.
// source: counter.sql
package psqlcore
import ( "context" )
const bumpCounter = `-- name: BumpCounter :exec UPDATE core_counter SET value = value + 1 WHERE id = $1::text AND value <= $2::int `
type BumpCounterParams struct { ID string `json:"id"` Value int32 `json:"value"` }
func (q *Queries) BumpCounter(ctx context.Context, arg BumpCounterParams) error { _, err := q.db.ExecContext(ctx, bumpCounter, arg.ID, arg.Value) return err }
const ensureCounter = `-- name: EnsureCounter :exec INSERT INTO core_counter (id, value) VALUES ($1::text, 0) ON CONFLICT DO NOTHING `
func (q *Queries) EnsureCounter(ctx context.Context, dollar_1 string) error { _, err := q.db.ExecContext(ctx, ensureCounter, dollar_1) return err }
const incrementCounter = `-- name: IncrementCounter :one UPDATE core_counter SET value = value + 1 WHERE id = $1::text RETURNING value::int `
func (q *Queries) IncrementCounter(ctx context.Context, dollar_1 string) (int32, error) { row := q.db.QueryRowContext(ctx, incrementCounter, dollar_1) var value int32 err := row.Scan(&value) return value, err }
|