Documentation
¶
Index ¶
- type DBTX
- type JobCancelParams
- type JobCountByAllStatesRow
- type JobCountByQueueAndStateRow
- type JobDeleteBeforeParams
- type JobGetAvailableParams
- type JobGetStuckParams
- type JobInsertFastNoReturningParams
- type JobInsertFastParams
- type JobInsertFullParams
- type JobKindListParams
- type JobRescueParams
- type JobRetryParams
- type JobScheduleGetCollisionParams
- type JobScheduleGetEligibleParams
- type JobScheduleSetDiscardedParams
- type JobSetMetadataIfNotRunningParams
- type JobSetStateIfRunningParams
- type JobUpdateFullParams
- type JobUpdateParams
- type LeaderAttemptElectParams
- type LeaderAttemptReelectParams
- type LeaderInsertParams
- type LeaderResignParams
- type Queries
- func (q *Queries) IndexExists(ctx context.Context, db DBTX, index string) (bool, error)
- func (q *Queries) JobCancel(ctx context.Context, db DBTX, arg *JobCancelParams) (*RiverJob, error)
- func (q *Queries) JobCountByAllStates(ctx context.Context, db DBTX) ([]*JobCountByAllStatesRow, error)
- func (q *Queries) JobCountByQueueAndState(ctx context.Context, db DBTX, queueNames []string) ([]*JobCountByQueueAndStateRow, error)
- func (q *Queries) JobCountByState(ctx context.Context, db DBTX, state string) (int64, error)
- func (q *Queries) JobDelete(ctx context.Context, db DBTX, id int64) (*RiverJob, error)
- func (q *Queries) JobDeleteBefore(ctx context.Context, db DBTX, arg *JobDeleteBeforeParams) (sql.Result, error)
- func (q *Queries) JobDeleteMany(ctx context.Context, db DBTX, max int64) ([]*RiverJob, error)
- func (q *Queries) JobGetAvailable(ctx context.Context, db DBTX, arg *JobGetAvailableParams) ([]*RiverJob, error)
- func (q *Queries) JobGetByID(ctx context.Context, db DBTX, id int64) (*RiverJob, error)
- func (q *Queries) JobGetByIDMany(ctx context.Context, db DBTX, id []int64) ([]*RiverJob, error)
- func (q *Queries) JobGetByKindMany(ctx context.Context, db DBTX, kind []string) ([]*RiverJob, error)
- func (q *Queries) JobGetStuck(ctx context.Context, db DBTX, arg *JobGetStuckParams) ([]*RiverJob, error)
- func (q *Queries) JobInsertFast(ctx context.Context, db DBTX, arg *JobInsertFastParams) (*RiverJob, error)
- func (q *Queries) JobInsertFastMany(ctx context.Context, db DBTX, jobs []byte) ([]*RiverJob, error)
- func (q *Queries) JobInsertFastManyNoReturning(ctx context.Context, db DBTX, jobs []byte) (int64, error)
- func (q *Queries) JobInsertFastNoReturning(ctx context.Context, db DBTX, arg *JobInsertFastNoReturningParams) (int64, error)
- func (q *Queries) JobInsertFull(ctx context.Context, db DBTX, arg *JobInsertFullParams) (*RiverJob, error)
- func (q *Queries) JobInsertFullMany(ctx context.Context, db DBTX, jobs []byte) ([]*RiverJob, error)
- func (q *Queries) JobKindList(ctx context.Context, db DBTX, arg *JobKindListParams) ([]string, error)
- func (q *Queries) JobList(ctx context.Context, db DBTX, max int64) ([]*RiverJob, error)
- func (q *Queries) JobRescue(ctx context.Context, db DBTX, arg *JobRescueParams) error
- func (q *Queries) JobRetry(ctx context.Context, db DBTX, arg *JobRetryParams) (*RiverJob, error)
- func (q *Queries) JobScheduleGetCollision(ctx context.Context, db DBTX, arg *JobScheduleGetCollisionParams) (*RiverJob, error)
- func (q *Queries) JobScheduleGetEligible(ctx context.Context, db DBTX, arg *JobScheduleGetEligibleParams) ([]*RiverJob, error)
- func (q *Queries) JobScheduleSetAvailable(ctx context.Context, db DBTX, id []int64) ([]*RiverJob, error)
- func (q *Queries) JobScheduleSetDiscarded(ctx context.Context, db DBTX, arg *JobScheduleSetDiscardedParams) ([]*RiverJob, error)
- func (q *Queries) JobSetMetadataIfNotRunning(ctx context.Context, db DBTX, arg *JobSetMetadataIfNotRunningParams) (*RiverJob, error)
- func (q *Queries) JobSetStateIfRunning(ctx context.Context, db DBTX, arg *JobSetStateIfRunningParams) (*RiverJob, error)
- func (q *Queries) JobUpdate(ctx context.Context, db DBTX, arg *JobUpdateParams) (*RiverJob, error)
- func (q *Queries) JobUpdateFull(ctx context.Context, db DBTX, arg *JobUpdateFullParams) (*RiverJob, error)
- func (q *Queries) LeaderAttemptElect(ctx context.Context, db DBTX, arg *LeaderAttemptElectParams) (*RiverLeader, error)
- func (q *Queries) LeaderAttemptReelect(ctx context.Context, db DBTX, arg *LeaderAttemptReelectParams) (*RiverLeader, error)
- func (q *Queries) LeaderDeleteExpired(ctx context.Context, db DBTX, now *string) (int64, error)
- func (q *Queries) LeaderGetElectedLeader(ctx context.Context, db DBTX) (*RiverLeader, error)
- func (q *Queries) LeaderInsert(ctx context.Context, db DBTX, arg *LeaderInsertParams) (*RiverLeader, error)
- func (q *Queries) LeaderResign(ctx context.Context, db DBTX, arg *LeaderResignParams) (int64, error)
- func (q *Queries) NotificationDeleteBefore(ctx context.Context, db DBTX, createdAtHorizon string) (int64, error)
- func (q *Queries) NotificationGetAfter(ctx context.Context, db DBTX, after int64) (*RiverNotification, error)
- func (q *Queries) NotificationGetLastID(ctx context.Context, db DBTX) (int64, error)
- func (q *Queries) NotificationInsertMany(ctx context.Context, db DBTX, notifications []byte) error
- func (q *Queries) QueueCreateOrSetUpdatedAt(ctx context.Context, db DBTX, arg *QueueCreateOrSetUpdatedAtParams) (*RiverQueue, error)
- func (q *Queries) QueueDeleteExpired(ctx context.Context, db DBTX, arg *QueueDeleteExpiredParams) ([]*RiverQueue, error)
- func (q *Queries) QueueGet(ctx context.Context, db DBTX, name string) (*RiverQueue, error)
- func (q *Queries) QueueList(ctx context.Context, db DBTX, max int64) ([]*RiverQueue, error)
- func (q *Queries) QueueNameList(ctx context.Context, db DBTX, arg *QueueNameListParams) ([]string, error)
- func (q *Queries) QueuePause(ctx context.Context, db DBTX, arg *QueuePauseParams) (int64, error)
- func (q *Queries) QueueResume(ctx context.Context, db DBTX, arg *QueueResumeParams) (int64, error)
- func (q *Queries) QueueUpdate(ctx context.Context, db DBTX, arg *QueueUpdateParams) (*RiverQueue, error)
- func (q *Queries) RiverMigrationDeleteAssumingMainMany(ctx context.Context, db DBTX, version []int64) ([]*RiverMigrationDeleteAssumingMainManyRow, error)
- func (q *Queries) RiverMigrationDeleteByLineAndVersionMany(ctx context.Context, db DBTX, ...) ([]*RiverMigration, error)
- func (q *Queries) RiverMigrationGetAllAssumingMain(ctx context.Context, db DBTX) ([]*RiverMigrationGetAllAssumingMainRow, error)
- func (q *Queries) RiverMigrationGetByLine(ctx context.Context, db DBTX, line string) ([]*RiverMigration, error)
- func (q *Queries) RiverMigrationInsertMany(ctx context.Context, db DBTX, arg *RiverMigrationInsertManyParams) ([]*RiverMigration, error)
- func (q *Queries) RiverMigrationInsertManyAssumingMain(ctx context.Context, db DBTX, versions []byte) ([]*RiverMigrationInsertManyAssumingMainRow, error)
- func (q *Queries) TableExists(ctx context.Context, db DBTX, table string) (bool, error)
- type QueueCreateOrSetUpdatedAtParams
- type QueueDeleteExpiredParams
- type QueueNameListParams
- type QueuePauseParams
- type QueueResumeParams
- type QueueUpdateParams
- type RiverJob
- type RiverLeader
- type RiverMigration
- type RiverMigrationDeleteAssumingMainManyRow
- type RiverMigrationDeleteByLineAndVersionManyParams
- type RiverMigrationGetAllAssumingMainRow
- type RiverMigrationInsertManyAssumingMainRow
- type RiverMigrationInsertManyParams
- type RiverNotification
- type RiverQueue
- type SqliteMaster
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobCancelParams ¶
type JobCountByAllStatesRow ¶ added in v0.24.0
type JobCountByQueueAndStateRow ¶ added in v0.24.0
type JobDeleteBeforeParams ¶
type JobGetAvailableParams ¶
type JobGetStuckParams ¶
type JobInsertFastParams ¶
type JobInsertFullParams ¶
type JobInsertFullParams struct {
Args interface{}
Attempt int64
AttemptedAt *string
AttemptedBy []byte
CreatedAt *string
Errors []byte
FinalizedAt *string
Kind string
MaxAttempts int64
Metadata interface{}
Priority int64
Queue string
ScheduledAt *string
State string
Tags interface{}
UniqueKey []byte
UniqueStates *int64
}
type JobKindListParams ¶ added in v0.24.0
type JobRescueParams ¶
type JobRetryParams ¶
type JobSetMetadataIfNotRunningParams ¶
type JobSetMetadataIfNotRunningParams struct {
MetadataUpdates interface{}
ID int64
}
type JobUpdateFullParams ¶ added in v0.29.0
type JobUpdateFullParams struct {
AttemptDoUpdate bool
Attempt int64
AttemptedAtDoUpdate bool
AttemptedAt *time.Time
AttemptedByDoUpdate bool
AttemptedBy interface{}
ErrorsDoUpdate bool
Errors interface{}
FinalizedAtDoUpdate bool
FinalizedAt *time.Time
MaxAttemptsDoUpdate bool
MaxAttempts int64
MetadataDoUpdate bool
Metadata interface{}
StateDoUpdate bool
State string
ID int64
}
type JobUpdateParams ¶
type LeaderInsertParams ¶
type LeaderResignParams ¶ added in v0.35.0
type Queries ¶
type Queries struct {
}
func (*Queries) IndexExists ¶
func (*Queries) JobCancel ¶
Differs by necessity from other drivers because SQLite doesn't support `UPDATE` inside CTEs so we can't retry if running but select otherwise. Instead, the driver uses a transaction to optimisticaly try an update, but perform a subsequent fetch on a not found to return the right status.
I had to invert the last 'AND' expression below (was an 'ANT NOT) due to an sqlc bug. Something about sqlc's SQLite parser cannot detect a parameter inside an `AND NOT`.
func (*Queries) JobCountByAllStates ¶ added in v0.24.0
func (*Queries) JobCountByQueueAndState ¶ added in v0.24.0
func (*Queries) JobCountByState ¶
func (*Queries) JobDelete ¶
Differs by necessity from other drivers because SQLite doesn't support `DELETE` inside CTEs so we can't delete if running but select otherwise. Instead, the driver uses a transaction to optimisticaly try a delete, but perform a subsequent fetch on a not found to return the right status.
func (*Queries) JobDeleteBefore ¶
func (*Queries) JobDeleteMany ¶ added in v0.24.0
func (*Queries) JobGetAvailable ¶
func (q *Queries) JobGetAvailable(ctx context.Context, db DBTX, arg *JobGetAvailableParams) ([]*RiverJob, error)
Differs from the Postgres version in that we don't have `FOR UPDATE SKIP LOCKED`. It doesn't exist in SQLite, but more aptly, there's only one writer on SQLite at a time, so nothing else has the rows locked.
func (*Queries) JobGetByID ¶
func (*Queries) JobGetByIDMany ¶
func (*Queries) JobGetByKindMany ¶
func (*Queries) JobGetStuck ¶
func (*Queries) JobInsertFast ¶
func (*Queries) JobInsertFastMany ¶ added in v0.40.0
func (*Queries) JobInsertFastManyNoReturning ¶ added in v0.40.0
func (*Queries) JobInsertFastNoReturning ¶
func (*Queries) JobInsertFull ¶
func (*Queries) JobInsertFullMany ¶ added in v0.40.0
func (*Queries) JobKindList ¶ added in v0.24.0
func (*Queries) JobRescue ¶
Rescue a job.
This is supposed to rescue jobs in batches, but various limitations of the combined SQLite + sqlc has left me unable to find a way of injecting many arguments en masse (like how we slightly abuse arrays to pull it off for the Postgres drivers), and SQLite doesn't support `UPDATE` in CTEs, so we loop over many insert operations instead, with the expectation that this may be fixable in the future. Because SQLite targets will often be local and with a very minimal round trip compared to a network, looping over operations is probably okay performance-wise.
func (*Queries) JobRetry ¶
Differs by necessity from other drivers because SQLite doesn't support `UPDATE` inside CTEs so we can't retry if running but select otherwise. Instead, the driver uses a transaction to optimisticaly try an update, but perform a subsequent fetch on a not found to return the right status.
I had to invert the last 'AND' expression below (was an 'AND NOT') due to an sqlc bug. Something about sqlc's SQLite parser cannot detect a parameter inside an `AND NOT`. I'll try to get this fixed upstream at some point so we can clean this up and keep it more like the Postgres version.
func (*Queries) JobScheduleGetCollision ¶
func (*Queries) JobScheduleGetEligible ¶
func (*Queries) JobScheduleSetAvailable ¶
func (*Queries) JobScheduleSetDiscarded ¶
func (*Queries) JobSetMetadataIfNotRunning ¶
func (q *Queries) JobSetMetadataIfNotRunning(ctx context.Context, db DBTX, arg *JobSetMetadataIfNotRunningParams) (*RiverJob, error)
This doesn't exist under the Postgres driver, but needed as an extra query for JobSetStateIfRunning to use when falling back to non-running jobs.
func (*Queries) JobSetStateIfRunning ¶
func (q *Queries) JobSetStateIfRunning(ctx context.Context, db DBTX, arg *JobSetStateIfRunningParams) (*RiverJob, error)
Differs significantly from the Postgres version in that it can't do a bulk update, and since sqlc doesn't support `UPDATE` in CTEs, we need separate queries like JobSetMetadataIfNotRunning to do the fallback work.
func (*Queries) JobUpdateFull ¶ added in v0.29.0
func (q *Queries) JobUpdateFull(ctx context.Context, db DBTX, arg *JobUpdateFullParams) (*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 ¶
func (q *Queries) LeaderAttemptElect(ctx context.Context, db DBTX, arg *LeaderAttemptElectParams) (*RiverLeader, error)
func (*Queries) LeaderAttemptReelect ¶
func (q *Queries) LeaderAttemptReelect(ctx context.Context, db DBTX, arg *LeaderAttemptReelectParams) (*RiverLeader, error)
func (*Queries) LeaderDeleteExpired ¶
func (*Queries) LeaderGetElectedLeader ¶
func (*Queries) LeaderInsert ¶
func (q *Queries) LeaderInsert(ctx context.Context, db DBTX, arg *LeaderInsertParams) (*RiverLeader, error)
func (*Queries) LeaderResign ¶
func (*Queries) NotificationDeleteBefore ¶ added in v0.40.0
func (*Queries) NotificationGetAfter ¶ added in v0.40.0
func (*Queries) NotificationGetLastID ¶ added in v0.40.0
func (*Queries) NotificationInsertMany ¶ added in v0.40.0
func (*Queries) QueueCreateOrSetUpdatedAt ¶
func (q *Queries) QueueCreateOrSetUpdatedAt(ctx context.Context, db DBTX, arg *QueueCreateOrSetUpdatedAtParams) (*RiverQueue, error)
func (*Queries) QueueDeleteExpired ¶
func (q *Queries) QueueDeleteExpired(ctx context.Context, db DBTX, arg *QueueDeleteExpiredParams) ([]*RiverQueue, error)
func (*Queries) QueueNameList ¶ added in v0.24.0
func (*Queries) QueuePause ¶
func (*Queries) QueueResume ¶
func (*Queries) QueueUpdate ¶
func (q *Queries) QueueUpdate(ctx context.Context, db DBTX, arg *QueueUpdateParams) (*RiverQueue, error)
func (*Queries) RiverMigrationDeleteAssumingMainMany ¶
func (*Queries) RiverMigrationDeleteByLineAndVersionMany ¶
func (q *Queries) RiverMigrationDeleteByLineAndVersionMany(ctx context.Context, db DBTX, arg *RiverMigrationDeleteByLineAndVersionManyParams) ([]*RiverMigration, error)
func (*Queries) RiverMigrationGetAllAssumingMain ¶
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 ¶
func (*Queries) RiverMigrationInsertMany ¶ added in v0.40.0
func (q *Queries) RiverMigrationInsertMany(ctx context.Context, db DBTX, arg *RiverMigrationInsertManyParams) ([]*RiverMigration, error)
func (*Queries) RiverMigrationInsertManyAssumingMain ¶ added in v0.40.0
type QueueNameListParams ¶ added in v0.24.0
type QueuePauseParams ¶
type QueueResumeParams ¶
type QueueUpdateParams ¶
type RiverJob ¶
type RiverJob struct {
ID int64
Args []byte
Attempt int64
AttemptedAt *time.Time
AttemptedBy []byte
CreatedAt time.Time
Errors []byte
FinalizedAt *time.Time
Kind string
MaxAttempts int64
Metadata []byte
Priority int64
Queue string
State string
ScheduledAt time.Time
Tags []byte
UniqueKey []byte
UniqueStates *int64
}