// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.27.0 // source: share.sql package database import ( "context" "github.com/google/uuid" "github.com/jackc/pgx/v5/pgtype" ) const createShare = `-- name: CreateShare :exec INSERT INTO shares ( id, entity_type, entity_id, entity_date, owner, expiration ) VALUES ($1, $2, $3, $4, $5, $6) ` type CreateShareParams struct { ID string `json:"id"` EntityType string `json:"entity_type"` EntityID uuid.UUID `json:"entity_id"` EntityDate pgtype.Timestamptz `json:"entity_date"` Owner int `json:"owner"` Expiration pgtype.Timestamptz `json:"expiration"` } func (q *Queries) CreateShare(ctx context.Context, arg CreateShareParams) error { _, err := q.db.Exec(ctx, createShare, arg.ID, arg.EntityType, arg.EntityID, arg.EntityDate, arg.Owner, arg.Expiration, ) return err } const deleteShare = `-- name: DeleteShare :exec DELETE FROM shares WHERE id = $1 ` func (q *Queries) DeleteShare(ctx context.Context, id string) error { _, err := q.db.Exec(ctx, deleteShare, id) return err } const getShare = `-- name: GetShare :one SELECT id, entity_type, entity_id, entity_date, owner, expiration FROM shares WHERE id = $1 ` func (q *Queries) GetShare(ctx context.Context, id string) (Share, error) { row := q.db.QueryRow(ctx, getShare, id) var i Share err := row.Scan( &i.ID, &i.EntityType, &i.EntityID, &i.EntityDate, &i.Owner, &i.Expiration, ) return i, err } const pruneShares = `-- name: PruneShares :exec DELETE FROM shares WHERE expiration < NOW() ` func (q *Queries) PruneShares(ctx context.Context) error { _, err := q.db.Exec(ctx, pruneShares) return err }