dbsqlc

package
v0.52.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: MPL-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnExistsParams

type ColumnExistsParams struct {
	SchemaAndTable string
	ColumnName     string
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type IndexExistsParams

type IndexExistsParams struct {
	Index  string
	Schema sql.NullString
}

type IndexReindexArtifactsParams

type IndexReindexArtifactsParams struct {
	Index  string
	Schema sql.NullString
}

type IndexesExistParams

type IndexesExistParams struct {
	Schema     sql.NullString
	IndexNames []string
}

type IndexesExistRow

type IndexesExistRow struct {
	IndexName string
	Exists    bool
}

type JobCancelParams

type JobCancelParams struct {
	ID                int64
	Notify            bool
	Schema            sql.NullString
	ControlTopic      string
	Now               *time.Time
	CancelAttemptedAt string
}

type JobCountByAllStatesRow

type JobCountByAllStatesRow struct {
	State RiverJobState
	Count int64
}

type JobCountByQueueAndStateRow

type JobCountByQueueAndStateRow struct {
	Queue          string
	CountAvailable int64
	CountRunning   int64
}

type JobDeleteBeforeParams

type JobDeleteBeforeParams struct {
	CancelledDoDelete           interface{}
	CancelledFinalizedAtHorizon time.Time
	CompletedDoDelete           interface{}
	CompletedFinalizedAtHorizon time.Time
	DiscardedDoDelete           interface{}
	DiscardedFinalizedAtHorizon time.Time
	QueuesExcluded              []string
	QueuesIncluded              []string
	Max                         int64
}

type JobGetAvailableParams

type JobGetAvailableParams struct {
	Now            *time.Time
	MaxAttemptedBy int32
	AttemptedBy    string
	Queue          string
	Kind           []string
	MaxToLock      int32
}

type JobGetStuckParams

type JobGetStuckParams struct {
	AfterID      int64
	StuckHorizon time.Time
	Max          int32
}

type JobInsertFastManyNoReturningParams

type JobInsertFastManyNoReturningParams struct {
	Args         []string
	CreatedAt    []time.Time
	Kind         []string
	MaxAttempts  []int16
	Metadata     []string
	Priority     []int16
	Queue        []string
	ScheduledAt  []time.Time
	State        []RiverJobState
	Tags         []string
	UniqueKey    [][]byte
	UniqueStates []int32
}

type JobInsertFastManyParams

type JobInsertFastManyParams struct {
	IDSequence   string
	ID           []int64
	Args         []string
	CreatedAt    []time.Time
	Kind         []string
	MaxAttempts  []int16
	Metadata     []string
	Priority     []int16
	Queue        []string
	ScheduledAt  []time.Time
	State        []string
	Tags         []string
	UniqueKey    [][]byte
	UniqueStates []int32
}

type JobInsertFastManyRow

type JobInsertFastManyRow struct {
	RiverJob                 RiverJob
	UniqueSkippedAsDuplicate bool
}

type JobInsertFullManyParams

type JobInsertFullManyParams struct {
	Args         []string
	Attempt      []int16
	AttemptedAt  []time.Time
	CreatedAt    []time.Time
	FinalizedAt  []time.Time
	Kind         []string
	MaxAttempts  []int16
	Metadata     []string
	Priority     []int16
	Queue        []string
	ScheduledAt  []time.Time
	State        []string
	Tags         []string
	UniqueKey    []string
	UniqueStates []int32
}

type JobInsertFullParams

type JobInsertFullParams struct {
	Args         string
	Attempt      int16
	AttemptedAt  *time.Time
	AttemptedBy  []string
	CreatedAt    *time.Time
	Errors       []string
	FinalizedAt  *time.Time
	Kind         string
	MaxAttempts  int16
	Metadata     string
	Priority     int16
	Queue        string
	ScheduledAt  *time.Time
	State        RiverJobState
	Tags         []string
	UniqueKey    string
	UniqueStates int32
}

type JobKindListParams

type JobKindListParams struct {
	Match   interface{}
	After   interface{}
	Exclude []string
	Max     int32
}

type JobRescueManyParams

type JobRescueManyParams struct {
	StuckHorizon time.Time
	ID           []int64
	Error        []string
	FinalizedAt  []time.Time
	ScheduledAt  []time.Time
	State        []string
}

type JobRetryParams

type JobRetryParams struct {
	ID  int64
	Now *time.Time
}

type JobScheduleParams

type JobScheduleParams struct {
	Now *time.Time
	Max int64
}

type JobScheduleRow

type JobScheduleRow struct {
	RiverJob          RiverJob
	ConflictDiscarded bool
}

type JobSetStateIfRunningManyParams

type JobSetStateIfRunningManyParams struct {
	IDs                 []int64
	AttemptDoUpdate     []bool
	Attempt             []int32
	ErrorsDoUpdate      []bool
	Errors              []string
	FinalizedAtDoUpdate []bool
	FinalizedAt         []time.Time
	MetadataDoMerge     []bool
	MetadataUpdates     []string
	ScheduledAtDoUpdate []bool
	ScheduledAt         []time.Time
	State               []string
	Now                 *time.Time
}

type JobUpdateFullParams

type JobUpdateFullParams struct {
	AttemptDoUpdate     bool
	Attempt             int16
	AttemptedAtDoUpdate bool
	AttemptedAt         *time.Time
	AttemptedByDoUpdate bool
	AttemptedBy         []string
	ErrorsDoUpdate      bool
	Errors              []string
	FinalizedAtDoUpdate bool
	FinalizedAt         *time.Time
	MaxAttemptsDoUpdate bool
	MaxAttempts         int16
	MetadataDoUpdate    bool
	Metadata            string
	StateDoUpdate       bool
	State               RiverJobState
	ID                  int64
}

type JobUpdateParams

type JobUpdateParams struct {
	MetadataDoMerge bool
	Metadata        string
	ID              int64
}

type LeaderAttemptElectParams

type LeaderAttemptElectParams struct {
	LeaderID string
	Now      *time.Time
	TTL      float64
}

type LeaderAttemptReelectParams

type LeaderAttemptReelectParams struct {
	Now       *time.Time
	TTL       float64
	ElectedAt time.Time
	LeaderID  string
}

type LeaderInsertParams

type LeaderInsertParams struct {
	ElectedAt *time.Time
	Now       *time.Time
	ExpiresAt *time.Time
	TTL       float64
	LeaderID  string
}

type LeaderResignParams

type LeaderResignParams struct {
	ElectedAt       time.Time
	LeaderID        string
	Notify          bool
	Schema          sql.NullString
	LeadershipTopic string
}

type NotificationDeleteBeforeParams

type NotificationDeleteBeforeParams struct {
	CreatedAtHorizon time.Time
	Max              int64
}

type NullRiverJobState

type NullRiverJobState struct {
	RiverJobState RiverJobState
	Valid         bool // Valid is true if RiverJobState is not NULL
}

func (*NullRiverJobState) Scan

func (ns *NullRiverJobState) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullRiverJobState) Value

func (ns NullRiverJobState) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type PGGetProductAndVersionRow

type PGGetProductAndVersionRow struct {
	Product               string
	VersionNum            int32
	YbListenNotifyEnabled bool
}

type PGNotifyManyParams

type PGNotifyManyParams struct {
	Schema  sql.NullString
	Topic   string
	Payload []string
}

type Queries

type Queries struct {
}

func New

func New() *Queries

func (*Queries) ColumnExists

func (q *Queries) ColumnExists(ctx context.Context, db DBTX, arg *ColumnExistsParams) (bool, error)

Resolves the table the same way as TableExists (`to_regclass`, which falls back to `search_path` when the name is unqualified) so that the two agree on which table is being inspected.

func (*Queries) IndexExists

func (q *Queries) IndexExists(ctx context.Context, db DBTX, arg *IndexExistsParams) (bool, error)

func (*Queries) IndexReindexArtifacts

func (q *Queries) IndexReindexArtifacts(ctx context.Context, db DBTX, arg *IndexReindexArtifactsParams) ([]string, error)

func (*Queries) IndexesExist

func (q *Queries) IndexesExist(ctx context.Context, db DBTX, arg *IndexesExistParams) ([]*IndexesExistRow, error)

func (*Queries) JobCancel

func (q *Queries) JobCancel(ctx context.Context, db DBTX, arg *JobCancelParams) (*RiverJob, error)

func (*Queries) JobCountByAllStates

func (q *Queries) JobCountByAllStates(ctx context.Context, db DBTX) ([]*JobCountByAllStatesRow, error)

func (*Queries) JobCountByQueueAndState

func (q *Queries) JobCountByQueueAndState(ctx context.Context, db DBTX, queueNames []string) ([]*JobCountByQueueAndStateRow, error)

func (*Queries) JobCountByState

func (q *Queries) JobCountByState(ctx context.Context, db DBTX, state RiverJobState) (int64, error)

func (*Queries) JobDelete

func (q *Queries) JobDelete(ctx context.Context, db DBTX, id int64) (*RiverJob, error)

func (*Queries) JobDeleteBefore

func (q *Queries) JobDeleteBefore(ctx context.Context, db DBTX, arg *JobDeleteBeforeParams) (sql.Result, error)

func (*Queries) JobDeleteMany

func (q *Queries) JobDeleteMany(ctx context.Context, db DBTX, max int32) ([]*RiverJob, error)

this last SELECT step is necessary because there's no other way to define order records come back from a DELETE statement

func (*Queries) JobGetAvailable

func (q *Queries) JobGetAvailable(ctx context.Context, db DBTX, arg *JobGetAvailableParams) ([]*RiverJob, error)

func (*Queries) JobGetByID

func (q *Queries) JobGetByID(ctx context.Context, db DBTX, id int64) (*RiverJob, error)

func (*Queries) JobGetByIDMany

func (q *Queries) JobGetByIDMany(ctx context.Context, db DBTX, id []int64) ([]*RiverJob, error)

func (*Queries) JobGetByKindMany

func (q *Queries) JobGetByKindMany(ctx context.Context, db DBTX, kind []string) ([]*RiverJob, error)

func (*Queries) JobGetCancelRequested

func (q *Queries) JobGetCancelRequested(ctx context.Context, db DBTX, id []int64) ([]int64, error)

func (*Queries) JobGetStuck

func (q *Queries) JobGetStuck(ctx context.Context, db DBTX, arg *JobGetStuckParams) ([]*RiverJob, error)

func (*Queries) JobInsertFastMany

func (q *Queries) JobInsertFastMany(ctx context.Context, db DBTX, arg *JobInsertFastManyParams) ([]*JobInsertFastManyRow, error)

func (*Queries) JobInsertFastManyNoReturning

func (q *Queries) JobInsertFastManyNoReturning(ctx context.Context, db DBTX, arg *JobInsertFastManyNoReturningParams) (int64, error)

func (*Queries) JobInsertFull

func (q *Queries) JobInsertFull(ctx context.Context, db DBTX, arg *JobInsertFullParams) (*RiverJob, error)

func (*Queries) JobInsertFullMany

func (q *Queries) JobInsertFullMany(ctx context.Context, db DBTX, arg *JobInsertFullManyParams) ([]*RiverJob, error)

func (*Queries) JobKindList

func (q *Queries) JobKindList(ctx context.Context, db DBTX, arg *JobKindListParams) ([]string, error)

func (*Queries) JobList

func (q *Queries) JobList(ctx context.Context, db DBTX, max int32) ([]*RiverJob, error)

func (*Queries) JobRescueMany

func (q *Queries) JobRescueMany(ctx context.Context, db DBTX, arg *JobRescueManyParams) error

Run by the rescuer to queue for retry or discard depending on job state.

func (*Queries) JobRetry

func (q *Queries) JobRetry(ctx context.Context, db DBTX, arg *JobRetryParams) (*RiverJob, error)

func (*Queries) JobSchedule

func (q *Queries) JobSchedule(ctx context.Context, db DBTX, arg *JobScheduleParams) ([]*JobScheduleRow, error)

func (*Queries) JobSetStateIfRunningMany

func (q *Queries) JobSetStateIfRunningMany(ctx context.Context, db DBTX, arg *JobSetStateIfRunningManyParams) ([]*RiverJob, error)

func (*Queries) JobUpdate

func (q *Queries) JobUpdate(ctx context.Context, db DBTX, arg *JobUpdateParams) (*RiverJob, error)

func (*Queries) JobUpdateFull

func (q *Queries) JobUpdateFull(ctx context.Context, db DBTX, arg *JobUpdateFullParams) (*RiverJob, error)

A generalized update for any property on a job. This brings in a large number of parameters and therefore may be more suitable for testing than production.

func (*Queries) LeaderAttemptElect

func (q *Queries) LeaderAttemptElect(ctx context.Context, db DBTX, arg *LeaderAttemptElectParams) (*RiverLeader, error)

func (*Queries) LeaderAttemptReelect

func (q *Queries) LeaderAttemptReelect(ctx context.Context, db DBTX, arg *LeaderAttemptReelectParams) (*RiverLeader, error)

func (*Queries) LeaderDeleteExpired

func (q *Queries) LeaderDeleteExpired(ctx context.Context, db DBTX, now *time.Time) (int64, error)

func (*Queries) LeaderGetElectedLeader

func (q *Queries) LeaderGetElectedLeader(ctx context.Context, db DBTX) (*RiverLeader, error)

func (*Queries) LeaderInsert

func (q *Queries) LeaderInsert(ctx context.Context, db DBTX, arg *LeaderInsertParams) (*RiverLeader, error)

func (*Queries) LeaderResign

func (q *Queries) LeaderResign(ctx context.Context, db DBTX, arg *LeaderResignParams) (int64, error)

func (*Queries) NotificationDeleteBefore

func (q *Queries) NotificationDeleteBefore(ctx context.Context, db DBTX, arg *NotificationDeleteBeforeParams) (int64, error)

func (*Queries) PGAdvisoryXactLock

func (q *Queries) PGAdvisoryXactLock(ctx context.Context, db DBTX, key int64) error

func (*Queries) PGGetProductAndVersion

func (q *Queries) PGGetProductAndVersion(ctx context.Context, db DBTX) (*PGGetProductAndVersionRow, error)

func (*Queries) PGNotifyMany

func (q *Queries) PGNotifyMany(ctx context.Context, db DBTX, arg *PGNotifyManyParams) error

func (*Queries) QueueCreateOrSetUpdatedAt

func (q *Queries) QueueCreateOrSetUpdatedAt(ctx context.Context, db DBTX, arg *QueueCreateOrSetUpdatedAtParams) (*RiverQueue, error)

func (*Queries) QueueDeleteExpired

func (q *Queries) QueueDeleteExpired(ctx context.Context, db DBTX, arg *QueueDeleteExpiredParams) ([]*RiverQueue, error)

func (*Queries) QueueGet

func (q *Queries) QueueGet(ctx context.Context, db DBTX, name string) (*RiverQueue, error)

func (*Queries) QueueList

func (q *Queries) QueueList(ctx context.Context, db DBTX, max int32) ([]*RiverQueue, error)

func (*Queries) QueueNameList

func (q *Queries) QueueNameList(ctx context.Context, db DBTX, arg *QueueNameListParams) ([]string, error)

func (*Queries) QueuePause

func (q *Queries) QueuePause(ctx context.Context, db DBTX, arg *QueuePauseParams) (int64, error)

func (*Queries) QueueResume

func (q *Queries) QueueResume(ctx context.Context, db DBTX, arg *QueueResumeParams) (int64, error)

func (*Queries) QueueUpdate

func (q *Queries) QueueUpdate(ctx context.Context, db DBTX, arg *QueueUpdateParams) (*RiverQueue, error)

func (*Queries) RiverMigrationDeleteAssumingMainMany

func (q *Queries) RiverMigrationDeleteAssumingMainMany(ctx context.Context, db DBTX, version []int64) ([]*RiverMigrationDeleteAssumingMainManyRow, error)

func (*Queries) RiverMigrationDeleteByLineAndVersionMany

func (q *Queries) RiverMigrationDeleteByLineAndVersionMany(ctx context.Context, db DBTX, arg *RiverMigrationDeleteByLineAndVersionManyParams) ([]*RiverMigration, error)

func (*Queries) RiverMigrationGetAllAssumingMain

func (q *Queries) RiverMigrationGetAllAssumingMain(ctx context.Context, db DBTX) ([]*RiverMigrationGetAllAssumingMainRow, error)

This is a compatibility query for getting existing migrations before the `line` column was added to the table in version 005. We need to make sure to only select non-line properties so the query doesn't error on older schemas. (Even if we use `SELECT *` below, sqlc materializes it to a list of column names in the generated query.)

func (*Queries) RiverMigrationGetByLine

func (q *Queries) RiverMigrationGetByLine(ctx context.Context, db DBTX, line string) ([]*RiverMigration, error)

func (*Queries) RiverMigrationInsert

func (q *Queries) RiverMigrationInsert(ctx context.Context, db DBTX, arg *RiverMigrationInsertParams) (*RiverMigration, error)

func (*Queries) RiverMigrationInsertMany

func (q *Queries) RiverMigrationInsertMany(ctx context.Context, db DBTX, arg *RiverMigrationInsertManyParams) ([]*RiverMigration, error)

func (*Queries) RiverMigrationInsertManyAssumingMain

func (q *Queries) RiverMigrationInsertManyAssumingMain(ctx context.Context, db DBTX, version []int64) ([]*RiverMigrationInsertManyAssumingMainRow, error)

func (*Queries) RiverMigrationLock added in v0.52.0

func (q *Queries) RiverMigrationLock(ctx context.Context, db DBTX, arg *RiverMigrationLockParams) error

Takes a transaction-scoped advisory lock that serializes migrators operating on the same schema and line. An empty schema resolves to the current schema so that it serializes with migrators targeting that schema explicitly.

func (*Queries) RiverMigrationLockRefreshCatalog added in v0.52.0

func (q *Queries) RiverMigrationLockRefreshCatalog(ctx context.Context, db DBTX) error

Runs after RiverMigrationLock so that the transaction sees tables that other migrators created while it waited for the lock. Name lookups like `to_regclass` don't process pending catalog invalidations, so one made before the wait (even in an earlier transaction) could keep reporting a table as missing. Locking a relation for the first time in a transaction processes them, and `pg_class` always exists.

func (*Queries) SchemaGetExpired

func (q *Queries) SchemaGetExpired(ctx context.Context, db DBTX, arg *SchemaGetExpiredParams) ([]string, error)

func (*Queries) TableExists

func (q *Queries) TableExists(ctx context.Context, db DBTX, schemaAndTable string) (bool, error)

type QueueCreateOrSetUpdatedAtParams

type QueueCreateOrSetUpdatedAtParams struct {
	Now       *time.Time
	Metadata  string
	Name      string
	PausedAt  *time.Time
	UpdatedAt *time.Time
}

type QueueDeleteExpiredParams

type QueueDeleteExpiredParams struct {
	UpdatedAtHorizon time.Time
	Max              int64
}

type QueueNameListParams

type QueueNameListParams struct {
	After   string
	Match   string
	Exclude []string
	Max     int32
}

type QueuePauseParams

type QueuePauseParams struct {
	Now  *time.Time
	Name string
}

type QueueResumeParams

type QueueResumeParams struct {
	Now  *time.Time
	Name string
}

type QueueUpdateParams

type QueueUpdateParams struct {
	MetadataDoUpdate bool
	Metadata         string
	Name             string
}

type RiverJob

type RiverJob struct {
	ID           int64
	Args         string
	Attempt      int16
	AttemptedAt  *time.Time
	AttemptedBy  []string
	CreatedAt    time.Time
	Errors       []string
	FinalizedAt  *time.Time
	Kind         string
	MaxAttempts  int16
	Metadata     string
	Priority     int16
	Queue        string
	State        RiverJobState
	ScheduledAt  time.Time
	Tags         []string
	UniqueKey    []byte
	UniqueStates *int
}

type RiverJobState

type RiverJobState string
const (
	RiverJobStateAvailable RiverJobState = "available"
	RiverJobStateCancelled RiverJobState = "cancelled"
	RiverJobStateCompleted RiverJobState = "completed"
	RiverJobStateDiscarded RiverJobState = "discarded"
	RiverJobStatePending   RiverJobState = "pending"
	RiverJobStateRetryable RiverJobState = "retryable"
	RiverJobStateRunning   RiverJobState = "running"
	RiverJobStateScheduled RiverJobState = "scheduled"
)

func (*RiverJobState) Scan

func (e *RiverJobState) Scan(src interface{}) error

type RiverLeader

type RiverLeader struct {
	ElectedAt time.Time
	ExpiresAt time.Time
	LeaderID  string
	Name      string
}

type RiverMigration

type RiverMigration struct {
	Line      string
	Version   int64
	CreatedAt time.Time
}

type RiverMigrationDeleteAssumingMainManyRow

type RiverMigrationDeleteAssumingMainManyRow struct {
	CreatedAt time.Time
	Version   int64
}

type RiverMigrationDeleteByLineAndVersionManyParams

type RiverMigrationDeleteByLineAndVersionManyParams struct {
	Line    string
	Version []int64
}

type RiverMigrationGetAllAssumingMainRow

type RiverMigrationGetAllAssumingMainRow struct {
	CreatedAt time.Time
	Version   int64
}

type RiverMigrationInsertManyAssumingMainRow

type RiverMigrationInsertManyAssumingMainRow struct {
	CreatedAt time.Time
	Version   int64
}

type RiverMigrationInsertManyParams

type RiverMigrationInsertManyParams struct {
	Line    string
	Version []int64
}

type RiverMigrationInsertParams

type RiverMigrationInsertParams struct {
	Line    string
	Version int64
}

type RiverMigrationLockParams added in v0.52.0

type RiverMigrationLockParams struct {
	Schema sql.NullString
	Line   string
}

type RiverNotification

type RiverNotification struct {
	ID        int64
	CreatedAt time.Time
	Payload   string
	Topic     string
}

type RiverQueue

type RiverQueue struct {
	Name      string
	CreatedAt time.Time
	Metadata  string
	PausedAt  *time.Time
	UpdatedAt time.Time
}

type SchemaGetExpiredParams

type SchemaGetExpiredParams struct {
	Prefix     interface{}
	BeforeName interface{}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL