dbsqlc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 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 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 {
	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
	JobControlTopic   string
	CancelAttemptedAt json.RawMessage
}

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        json.RawMessage
	FinalizedAt *time.Time
	Kind        string
	MaxAttempts int16
	Metadata    json.RawMessage
	Priority    int16
	Queue       string
	ScheduledAt *time.Time
	State       JobState
	Tags        []string
}

type JobInsertFullParams added in v0.0.23

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

type JobRescueManyParams added in v0.0.23

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

type JobScheduleParams added in v0.0.23

type JobScheduleParams struct {
	InsertTopic string
	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               JobState
	ID                  int64
	FinalizedAtDoUpdate bool
	FinalizedAt         *time.Time
	ErrorDoUpdate       bool
	Error               json.RawMessage
	MaxAttemptsUpdate   bool
	MaxAttempts         int16
	ScheduledAtDoUpdate bool
	ScheduledAt         *time.Time
}

type JobState added in v0.0.23

type JobState string
const (
	RiverJobStateAvailable JobState = "available"
	RiverJobStateCancelled JobState = "cancelled"
	RiverJobStateCompleted JobState = "completed"
	RiverJobStateDiscarded JobState = "discarded"
	RiverJobStateRetryable JobState = "retryable"
	RiverJobStateRunning   JobState = "running"
	RiverJobStateScheduled JobState = "scheduled"
)

func (*JobState) Scan added in v0.0.23

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

type JobUpdateParams added in v0.0.23

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

type LeaderAttemptElectParams added in v0.0.23

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

type LeaderAttemptReelectParams added in v0.0.23

type LeaderAttemptReelectParams struct {
	Name     string
	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
	Name      string
}

type LeaderResignParams added in v0.0.23

type LeaderResignParams struct {
	Name            string
	LeaderID        string
	LeadershipTopic string
}

type NullJobState added in v0.0.23

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

func (*NullJobState) Scan added in v0.0.23

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

Scan implements the Scanner interface.

func (NullJobState) Value added in v0.0.23

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

Value implements the driver Valuer interface.

type PGNotifyParams added in v0.0.23

type PGNotifyParams 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 JobState) (int64, 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) 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) (int64, 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, name string) (int64, error)

func (*Queries) LeaderGetElectedLeader added in v0.0.23

func (q *Queries) LeaderGetElectedLeader(ctx context.Context, db DBTX, name string) (*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) PGNotify added in v0.0.23

func (q *Queries) PGNotify(ctx context.Context, db DBTX, arg *PGNotifyParams) 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 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    json.RawMessage
	Priority    int16
	Queue       string
	State       JobState
	ScheduledAt time.Time
	Tags        []string
}

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
}

Jump to

Keyboard shortcuts

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