dbsqlc

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 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 AttemptError added in v0.0.23

type AttemptError struct {
	At      time.Time `json:"at"`
	Attempt uint16    `json:"attempt"`
	Error   string    `json:"error"`
	Trace   string    `json:"trace"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

type JobCancelParams added in v0.0.23

type JobCancelParams struct {
	ID                int64
	ControlTopic      string
	CancelAttemptedAt []byte
}

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
	Max         int32
}

type JobGetByKindAndUniquePropertiesParams added in v0.0.23

type JobGetByKindAndUniquePropertiesParams struct {
	Kind           string
	ByArgs         bool
	Args           []byte
	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 JobInsertFastParams added in v0.0.23

type JobInsertFastParams struct {
	Args        []byte
	FinalizedAt *time.Time
	Kind        string
	MaxAttempts int16
	Metadata    []byte
	Priority    int16
	Queue       string
	ScheduledAt *time.Time
	State       RiverJobState
	Tags        []string
}

type JobInsertFullParams added in v0.0.23

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

type JobInsertManyParams added in v0.0.23

type JobInsertManyParams struct {
	Args        []byte
	FinalizedAt *time.Time
	Kind        string
	MaxAttempts int16
	Metadata    []byte
	Priority    int16
	Queue       string
	ScheduledAt time.Time
	State       RiverJobState
	Tags        []string
}

type JobRescueManyParams added in v0.0.23

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

type JobScheduleParams added in v0.0.23

type JobScheduleParams struct {
	Now time.Time
	Max int64
}

type JobSetCompleteIfRunningManyParams added in v0.1.0

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

type JobSetStateIfRunningParams added in v0.0.23

type JobSetStateIfRunningParams struct {
	State               RiverJobState
	ID                  int64
	FinalizedAtDoUpdate bool
	FinalizedAt         *time.Time
	ErrorDoUpdate       bool
	Error               []byte
	MaxAttemptsUpdate   bool
	MaxAttempts         int16
	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              [][]byte
	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.0.23

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

func (*NullRiverJobState) Scan added in v0.0.23

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

Scan implements the Scanner interface.

func (NullRiverJobState) Value added in v0.0.23

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

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

func (*Queries) JobInsertFull added in v0.0.23

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

func (*Queries) JobInsertMany added in v0.0.23

func (q *Queries) JobInsertMany(ctx context.Context, db DBTX, arg []*JobInsertManyParams) (int64, 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) ([]*RiverJob, 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) 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.5.0

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

func (*Queries) QueueDeleteExpired added in v0.5.0

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

func (*Queries) QueueGet added in v0.5.0

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

func (*Queries) QueueList added in v0.5.0

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

func (*Queries) QueuePause added in v0.5.0

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

func (*Queries) QueueResume added in v0.5.0

func (q *Queries) QueueResume(ctx context.Context, db DBTX, name string) (pgconn.CommandTag, error)

func (*Queries) RiverMigrationDeleteByVersionMany

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

func (*Queries) RiverMigrationGetAll

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

func (*Queries) RiverMigrationInsert

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

func (*Queries) RiverMigrationInsertMany

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

func (*Queries) TableExists

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

type QueueCreateOrSetUpdatedAtParams added in v0.5.0

type QueueCreateOrSetUpdatedAtParams struct {
	Metadata  []byte
	Name      string
	PausedAt  *time.Time
	UpdatedAt *time.Time
}

type QueueDeleteExpiredParams added in v0.5.0

type QueueDeleteExpiredParams struct {
	UpdatedAtHorizon time.Time
	Max              int64
}

type RiverJob added in v0.0.23

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

type RiverJobState added in v0.0.23

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.0.23

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 {
	ID        int64
	CreatedAt time.Time
	Version   int64
}

type RiverQueue added in v0.5.0

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

Jump to

Keyboard shortcuts

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