dbsqlc

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttemptErrorFromInternal added in v0.0.6

func AttemptErrorFromInternal(e *AttemptError) rivertype.AttemptError

func JobRowFromInternal added in v0.0.6

func JobRowFromInternal(internal *RiverJob) *rivertype.JobRow

func JobRowsFromInternal added in v0.0.17

func JobRowsFromInternal(internal []*RiverJob) []*rivertype.JobRow

Types

type AttemptError

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

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

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
	ScheduledAt time.Time
	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 {
	InsertTopic string
	Now         time.Time
	Max         int64
}

type JobSetStateIfRunningParams added in v0.0.13

type JobSetStateIfRunningParams struct {
	State               JobState
	ID                  int64
	FinalizedAtDoUpdate bool
	FinalizedAt         *time.Time
	ErrorDoUpdate       bool
	Error               []byte
	MaxAttemptsUpdate   bool
	MaxAttempts         int16
	ScheduledAtDoUpdate bool
	ScheduledAt         time.Time
}

type JobSetStateParams added in v0.0.13

type JobSetStateParams struct {
	ErrorDoUpdate       bool
	Error               []byte
	FinalizedAtDoUpdate bool
	FinalizedAt         *time.Time
	MaxAttemptsUpdate   bool
	MaxAttempts         int16
	ScheduledAtDoUpdate bool
	ScheduledAt         time.Time
	State               JobState
	ID                  int64
}

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
	FinalizedAtDoUpdate bool
	FinalizedAt         *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
	LeadershipTopic 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) JobCancel added in v0.0.17

func (q *Queries) JobCancel(ctx context.Context, db DBTX, arg JobCancelParams) (*RiverJob, 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) JobRetryImmediately added in v0.0.19

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

func (*Queries) JobSchedule

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

func (*Queries) JobSetState added in v0.0.13

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

func (*Queries) JobSetStateIfRunning added in v0.0.13

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

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
}

Jump to

Keyboard shortcuts

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