dbsqlc

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MPL-2.0 Imports: 7 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 JobCancelParams added in v0.0.23

type JobCancelParams struct {
	ID                int64
	ControlTopic      string
	CancelAttemptedAt string
}

type JobDeleteBeforeParams added in v0.0.23

type JobDeleteBeforeParams struct {
	CancelledFinalizedAtHorizon time.Time
	CompletedFinalizedAtHorizon time.Time
	DiscardedFinalizedAtHorizon time.Time
	Max                         int64
}

type JobGetAvailableParams added in v0.0.23

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

type JobGetByKindAndUniquePropertiesParams added in v0.0.23

type JobGetByKindAndUniquePropertiesParams struct {
	Kind           string
	ByArgs         bool
	Args           string
	ByCreatedAt    bool
	CreatedAtBegin time.Time
	CreatedAtEnd   time.Time
	ByQueue        bool
	Queue          string
	ByState        bool
	State          []string
}

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
	Kind         []string
	MaxAttempts  []int16
	Metadata     []string
	Priority     []int16
	Queue        []string
	ScheduledAt  []time.Time
	State        []RiverJobState
	Tags         []string
	UniqueKey    [][]byte
	UniqueStates []pgtypealias.Bits
}

type JobInsertFastManyParams added in v0.10.0

type JobInsertFastManyParams struct {
	Args         []string
	Kind         []string
	MaxAttempts  []int16
	Metadata     []string
	Priority     []int16
	Queue        []string
	ScheduledAt  []time.Time
	State        []string
	Tags         []string
	UniqueKey    [][]byte
	UniqueStates []pgtypealias.Bits
}

type JobInsertFastManyRow added in v0.12.0

type JobInsertFastManyRow struct {
	RiverJob                 RiverJob
	UniqueSkippedAsDuplicate bool
}

type JobInsertFullParams added in v0.0.23

type JobInsertFullParams struct {
	Args         string
	Attempt      int16
	AttemptedAt  *time.Time
	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    []byte
	UniqueStates pgtypealias.Bits
}

type JobRescueManyParams added in v0.0.23

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

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

type JobSetCompleteIfRunningManyParams struct {
	ID          []int64
	FinalizedAt []time.Time
}

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
	ScheduledAtDoUpdate []bool
	ScheduledAt         []time.Time
	SnoozeDoIncrement   []bool
	State               []string
}

type JobSetStateIfRunningParams added in v0.0.23

type JobSetStateIfRunningParams struct {
	State               RiverJobState
	ID                  int64
	AttemptUpdate       bool
	Attempt             int16
	ErrorDoUpdate       bool
	Error               string
	FinalizedAtDoUpdate bool
	FinalizedAt         *time.Time
	SnoozeDoIncrement   bool
	ScheduledAtDoUpdate bool
	ScheduledAt         *time.Time
}

type JobUpdateParams added in v0.0.23

type JobUpdateParams struct {
	AttemptDoUpdate     bool
	Attempt             int16
	AttemptedAtDoUpdate bool
	AttemptedAt         *time.Time
	ErrorsDoUpdate      bool
	Errors              []string
	FinalizedAtDoUpdate bool
	FinalizedAt         *time.Time
	StateDoUpdate       bool
	State               RiverJobState
	ID                  int64
}

type LeaderAttemptElectParams added in v0.0.23

type LeaderAttemptElectParams struct {
	LeaderID string
	TTL      time.Duration
}

type LeaderAttemptReelectParams added in v0.0.23

type LeaderAttemptReelectParams struct {
	LeaderID string
	TTL      time.Duration
}

type LeaderInsertParams added in v0.0.23

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

type LeaderResignParams added in v0.0.23

type LeaderResignParams struct {
	LeaderID        string
	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 {
	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) JobCancel added in v0.0.23

func (q *Queries) JobCancel(ctx context.Context, db DBTX, arg *JobCancelParams) (*RiverJob, 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) (int64, error)

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

func (q *Queries) JobGetByKindAndUniqueProperties(ctx context.Context, db DBTX, arg *JobGetByKindAndUniquePropertiesParams) (*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) 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, id int64) (*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) JobSetCompleteIfRunningMany added in v0.1.0

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

func (*Queries) JobSetStateIfRunning added in v0.0.23

func (q *Queries) JobSetStateIfRunning(ctx context.Context, db DBTX, arg *JobSetStateIfRunningParams) (*RiverJob, 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)

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) (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, limitCount int32) ([]*RiverQueue, error)

func (*Queries) QueuePause added in v0.10.0

func (q *Queries) QueuePause(ctx context.Context, db DBTX, name string) (sql.Result, error)

func (*Queries) QueueResume added in v0.10.0

func (q *Queries) QueueResume(ctx context.Context, db DBTX, name string) (sql.Result, 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) TableExists

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

type QueueCreateOrSetUpdatedAtParams added in v0.10.0

type QueueCreateOrSetUpdatedAtParams struct {
	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 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 pgtypealias.Bits
}

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
}

Jump to

Keyboard shortcuts

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