dbsqlc

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientCreateOrSetUpdatedAtParams added in v0.10.0

type ClientCreateOrSetUpdatedAtParams struct {
	ID        string
	Metadata  string
	PausedAt  *time.Time
	UpdatedAt *time.Time
}

type ClientQueueCreateOrSetUpdatedAtManyParams added in v0.10.0

type ClientQueueCreateOrSetUpdatedAtManyParams struct {
	Metadata      string
	Name          []string
	PausedAt      *time.Time
	RiverClientID string
	UpdatedAt     *time.Time
}

type ColumnExistsParams added in v0.10.0

type ColumnExistsParams struct {
	TableName  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 added in v0.23.0

type IndexExistsParams struct {
	Index  string
	Schema sql.NullString
}

type IndexesExistParams added in v0.24.0

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

type IndexesExistRow added in v0.24.0

type IndexesExistRow struct {
	IndexName string
	Exists    bool
}

type JobCancelParams added in v0.0.23

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

type JobCountByAllStatesRow added in v0.24.0

type JobCountByAllStatesRow struct {
	State RiverJobState
	Count int64
}

type JobCountByQueueAndStateRow added in v0.24.0

type JobCountByQueueAndStateRow struct {
	Queue          string
	CountAvailable int64
	CountRunning   int64
}

type JobDeleteBeforeParams added in v0.0.23

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 added in v0.0.23

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

type JobGetStuckParams added in v0.0.23

type JobGetStuckParams struct {
	StuckHorizon time.Time
	Max          int32
}

type JobInsertFastManyNoReturningParams added in v0.12.0

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 added in v0.10.0

type JobInsertFastManyParams struct {
	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 added in v0.12.0

type JobInsertFastManyRow struct {
	RiverJob                 RiverJob
	UniqueSkippedAsDuplicate bool
}

type JobInsertFullManyParams added in v0.23.0

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 added in v0.0.23

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 added in v0.24.0

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

type JobRescueManyParams added in v0.0.23

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

type JobRetryParams added in v0.23.0

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

type JobScheduleParams added in v0.0.23

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

type JobScheduleRow added in v0.12.0

type JobScheduleRow struct {
	RiverJob          RiverJob
	ConflictDiscarded bool
}

type JobSetStateIfRunningManyParams added in v0.12.1

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 added in v0.29.0

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 added in v0.0.23

type JobUpdateParams struct {
	MetadataDoMerge bool
	Metadata        string
	ID              int64
}

type LeaderAttemptElectParams added in v0.0.23

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

type LeaderAttemptReelectParams added in v0.0.23

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

type LeaderInsertParams added in v0.0.23

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

type LeaderResignParams added in v0.0.23

type LeaderResignParams struct {
	LeaderID        string
	Schema          sql.NullString
	LeadershipTopic string
}

type NullRiverJobState added in v0.10.0

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

func (*NullRiverJobState) Scan added in v0.10.0

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

Scan implements the Scanner interface.

func (NullRiverJobState) Value added in v0.10.0

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

Value implements the driver Valuer interface.

type PGNotifyManyParams added in v0.5.0

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

type Queries

type Queries struct {
}

func New

func New() *Queries

func (*Queries) ClientCreateOrSetUpdatedAt added in v0.10.0

func (q *Queries) ClientCreateOrSetUpdatedAt(ctx context.Context, db DBTX, arg *ClientCreateOrSetUpdatedAtParams) (*RiverClient, error)

func (*Queries) ClientQueueCreateOrSetUpdatedAtMany added in v0.10.0

func (q *Queries) ClientQueueCreateOrSetUpdatedAtMany(ctx context.Context, db DBTX, arg *ClientQueueCreateOrSetUpdatedAtManyParams) (*RiverClientQueue, error)

func (*Queries) ColumnExists added in v0.10.0

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

func (*Queries) IndexExists added in v0.23.0

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

func (*Queries) IndexesExist added in v0.24.0

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

func (*Queries) JobCancel added in v0.0.23

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

func (*Queries) JobCountByAllStates added in v0.24.0

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

func (*Queries) JobCountByQueueAndState added in v0.24.0

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

func (*Queries) JobCountByState added in v0.1.0

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

func (*Queries) JobDelete added in v0.7.0

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

func (*Queries) JobDeleteBefore added in v0.0.23

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

func (*Queries) JobDeleteMany added in v0.24.0

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 added in v0.0.23

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

func (*Queries) JobGetByID added in v0.0.23

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

func (*Queries) JobGetByIDMany added in v0.0.23

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

func (*Queries) JobGetByKindMany added in v0.0.23

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

func (*Queries) JobGetStuck added in v0.0.23

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

func (*Queries) JobInsertFastMany added in v0.10.0

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

func (*Queries) JobInsertFastManyNoReturning added in v0.12.0

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

func (*Queries) JobInsertFull added in v0.0.23

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

func (*Queries) JobInsertFullMany added in v0.23.0

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

func (*Queries) JobKindList added in v0.24.0

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

func (*Queries) JobList added in v0.19.0

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

func (*Queries) JobRescueMany added in v0.0.23

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 added in v0.0.23

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

func (*Queries) JobSchedule added in v0.0.23

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

func (*Queries) JobSetStateIfRunningMany added in v0.12.1

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

func (*Queries) JobUpdate added in v0.0.23

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

func (*Queries) JobUpdateFull added in v0.29.0

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 added in v0.0.23

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

func (*Queries) LeaderAttemptReelect added in v0.0.23

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

func (*Queries) LeaderDeleteExpired added in v0.0.23

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

func (*Queries) LeaderGetElectedLeader added in v0.0.23

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

func (*Queries) LeaderInsert added in v0.0.23

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

func (*Queries) LeaderResign added in v0.0.23

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

func (*Queries) PGAdvisoryXactLock added in v0.0.23

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

func (*Queries) PGNotifyMany added in v0.5.0

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

func (*Queries) QueueCreateOrSetUpdatedAt added in v0.10.0

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

func (*Queries) QueueDeleteExpired added in v0.10.0

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

func (*Queries) QueueGet added in v0.10.0

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

func (*Queries) QueueList added in v0.10.0

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

func (*Queries) QueueNameList added in v0.24.0

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

func (*Queries) QueuePause added in v0.10.0

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

func (*Queries) QueueResume added in v0.10.0

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

func (*Queries) QueueUpdate added in v0.20.0

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

func (*Queries) RiverMigrationDeleteAssumingMainMany added in v0.10.0

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

func (*Queries) RiverMigrationDeleteByLineAndVersionMany added in v0.10.0

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

func (*Queries) RiverMigrationGetAllAssumingMain added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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

func (*Queries) SchemaGetExpired added in v0.21.0

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 added in v0.10.0

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

type QueueDeleteExpiredParams added in v0.10.0

type QueueDeleteExpiredParams struct {
	UpdatedAtHorizon time.Time
	Max              int64
}

type QueueNameListParams added in v0.24.0

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

type QueuePauseParams added in v0.23.0

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

type QueueResumeParams added in v0.23.0

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

type QueueUpdateParams added in v0.20.0

type QueueUpdateParams struct {
	MetadataDoUpdate bool
	Metadata         string
	Name             string
}

type RiverClient added in v0.10.0

type RiverClient struct {
	ID        string
	CreatedAt time.Time
	Metadata  string
	PausedAt  *time.Time
	UpdatedAt time.Time
}

type RiverClientQueue added in v0.10.0

type RiverClientQueue struct {
	RiverClientID    string
	Name             string
	CreatedAt        time.Time
	MaxWorkers       int64
	Metadata         string
	NumJobsCompleted int64
	NumJobsRunning   int64
	UpdatedAt        time.Time
}

type RiverJob added in v0.0.23

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 added in v0.10.0

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 added in v0.10.0

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

type RiverLeader added in v0.0.23

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 added in v0.10.0

type RiverMigrationDeleteAssumingMainManyRow struct {
	CreatedAt time.Time
	Version   int64
}

type RiverMigrationDeleteByLineAndVersionManyParams added in v0.10.0

type RiverMigrationDeleteByLineAndVersionManyParams struct {
	Line    string
	Version []int64
}

type RiverMigrationGetAllAssumingMainRow added in v0.10.0

type RiverMigrationGetAllAssumingMainRow struct {
	CreatedAt time.Time
	Version   int64
}

type RiverMigrationInsertManyAssumingMainRow added in v0.10.0

type RiverMigrationInsertManyAssumingMainRow struct {
	CreatedAt time.Time
	Version   int64
}

type RiverMigrationInsertManyParams added in v0.10.0

type RiverMigrationInsertManyParams struct {
	Line    string
	Version []int64
}

type RiverMigrationInsertParams added in v0.10.0

type RiverMigrationInsertParams struct {
	Line    string
	Version int64
}

type RiverQueue added in v0.10.0

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

type SchemaGetExpiredParams added in v0.21.0

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