dbsqlc

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: LGPL-3.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

type AttemptError struct {
	At    time.Time `json:"at"`
	Error string    `json:"error"`
	Num   uint16    `json:"num"`
	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 JobCompleteManyParams

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

type JobDeleteBeforeParams

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

type JobGetAvailableParams

type JobGetAvailableParams struct {
	Worker     string
	Queue      string
	LimitCount int32
}

type JobGetByKindAndUniquePropertiesParams

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

type JobGetStuckParams

type JobGetStuckParams struct {
	StuckHorizon time.Time
	LimitCount   int32
}

type JobInsertManyParams

type JobInsertManyParams struct {
	Args        []byte
	Errors      []AttemptError
	Kind        string
	MaxAttempts int16
	Metadata    []byte
	Priority    int16
	Queue       string
	State       JobState
	Tags        []string
}

type JobInsertParams

type JobInsertParams 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       JobState
	Tags        []string
}

type JobRescueManyParams added in v0.0.4

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

type JobScheduleParams

type JobScheduleParams struct {
	Now time.Time
	Max int64
}

type JobSetCancelledIfRunningParams

type JobSetCancelledIfRunningParams struct {
	ID          int64
	FinalizedAt time.Time
	Error       []byte
}

type JobSetCompletedIfRunningParams

type JobSetCompletedIfRunningParams struct {
	ID          int64
	FinalizedAt time.Time
}

type JobSetCompletedParams

type JobSetCompletedParams struct {
	FinalizedAt time.Time
	ID          int64
}

type JobSetDiscardedIfRunningParams

type JobSetDiscardedIfRunningParams struct {
	ID          int64
	FinalizedAt time.Time
	Error       []byte
}

type JobSetDiscardedParams

type JobSetDiscardedParams struct {
	FinalizedAt time.Time
	Error       []byte
	ID          int64
}

type JobSetErroredIfRunningParams

type JobSetErroredIfRunningParams struct {
	ID          int64
	ScheduledAt time.Time
	Error       []byte
}

type JobSetSnoozedIfRunningParams

type JobSetSnoozedIfRunningParams struct {
	ID          int64
	ScheduledAt time.Time
}

type JobState

type JobState string
const (
	JobStateAvailable JobState = "available"
	JobStateCancelled JobState = "cancelled"
	JobStateCompleted JobState = "completed"
	JobStateDiscarded JobState = "discarded"
	JobStateRetryable JobState = "retryable"
	JobStateRunning   JobState = "running"
	JobStateScheduled JobState = "scheduled"
)

func (*JobState) Scan

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

type JobUpdateParams

type JobUpdateParams struct {
	AttemptDoUpdate     bool
	Attempt             int16
	AttemptedAtDoUpdate bool
	AttemptedAt         *time.Time
	StateDoUpdate       bool
	State               JobState
	ID                  int64
}

type LeadershipAttemptElectParams

type LeadershipAttemptElectParams struct {
	Name     string
	LeaderID string
	TTL      time.Duration
}

type LeadershipAttemptReelectParams

type LeadershipAttemptReelectParams struct {
	Name     string
	LeaderID string
	TTL      time.Duration
}

type LeadershipResignParams

type LeadershipResignParams struct {
	Name     string
	LeaderID string
}

type NullJobState

type NullJobState struct {
	JobState JobState
	Valid    bool // Valid is true if JobState is not NULL
}

func (*NullJobState) Scan

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

Scan implements the Scanner interface.

func (NullJobState) Value

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

Value implements the driver Valuer interface.

type Queries

type Queries struct {
}

func New

func New() *Queries

func (*Queries) JobCompleteMany

func (q *Queries) JobCompleteMany(ctx context.Context, db DBTX, arg JobCompleteManyParams) error

func (*Queries) JobCountRunning

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

func (*Queries) JobDeleteBefore

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

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) JobGetByKind

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

func (*Queries) JobGetByKindAndUniqueProperties

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

func (*Queries) JobGetByKindMany

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

func (*Queries) JobGetStuck

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

func (*Queries) JobInsert

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

func (*Queries) JobInsertMany

func (q *Queries) JobInsertMany(ctx context.Context, db DBTX, arg []JobInsertManyParams) (int64, error)

func (*Queries) JobRescueMany added in v0.0.4

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) JobSchedule

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

func (*Queries) JobSetCancelledIfRunning

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

func (*Queries) JobSetCompleted

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

func (*Queries) JobSetCompletedIfRunning

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

func (*Queries) JobSetDiscarded

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

func (*Queries) JobSetDiscardedIfRunning

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

func (*Queries) JobSetErroredIfRunning

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

func (*Queries) JobSetSnoozedIfRunning

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

func (*Queries) JobUpdate

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) LeadershipAttemptElect

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

func (*Queries) LeadershipAttemptReelect

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

func (*Queries) LeadershipDeleteExpired

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

func (*Queries) LeadershipResign

func (q *Queries) LeadershipResign(ctx context.Context, db DBTX, arg LeadershipResignParams) error

func (*Queries) PGAdvisoryXactLock

func (q *Queries) PGAdvisoryXactLock(ctx context.Context, db DBTX, key int64) 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)

type RiverJob

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       JobState
	ScheduledAt time.Time
	Tags        []string
}

type RiverLeader

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
}

Jump to

Keyboard shortcuts

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