database

package
v0.0.0-...-d4deeb0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: GPL-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 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
}

type GoqueueJob

type GoqueueJob struct {
	JobID        int32              `json:"job_id"`
	QueueName    string             `json:"queue_name"`
	CreatedAt    pgtype.Timestamp   `json:"created_at"`
	StartedAt    pgtype.Timestamp   `json:"started_at"`
	FinishedAt   pgtype.Timestamp   `json:"finished_at"`
	ScheduledAt  pgtype.Timestamp   `json:"scheduled_at"`
	MaxRetries   int32              `json:"max_retries"`
	RetryAttempt int32              `json:"retry_attempt"`
	RetryPolicy  GoqueueRetryPolicy `json:"retry_policy"`
	Status       GoqueueJobStatus   `json:"status"`
	Error        pgtype.Text        `json:"error"`
	Arguments    []byte             `json:"arguments"`
}

type GoqueueJobStatus

type GoqueueJobStatus string
const (
	GoqueueJobStatusAvailable GoqueueJobStatus = "available"
	GoqueueJobStatusRunning   GoqueueJobStatus = "running"
	GoqueueJobStatusFailed    GoqueueJobStatus = "failed"
	GoqueueJobStatusFinished  GoqueueJobStatus = "finished"
)

func (*GoqueueJobStatus) Scan

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

type GoqueueQueue

type GoqueueQueue struct {
	QueueName string           `json:"queue_name"`
	IsFifo    bool             `json:"is_fifo"`
	CreatedAt pgtype.Timestamp `json:"created_at"`
}

type GoqueueRetryPolicy

type GoqueueRetryPolicy string
const (
	GoqueueRetryPolicyConstant    GoqueueRetryPolicy = "constant"
	GoqueueRetryPolicyLinear      GoqueueRetryPolicy = "linear"
	GoqueueRetryPolicyExponential GoqueueRetryPolicy = "exponential"
)

func (*GoqueueRetryPolicy) Scan

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

type InsertJobParams

type InsertJobParams struct {
	QueueName   string             `json:"queue_name"`
	ScheduledAt pgtype.Timestamp   `json:"scheduled_at"`
	Arguments   []byte             `json:"arguments"`
	MaxRetries  int32              `json:"max_retries"`
	RetryPolicy GoqueueRetryPolicy `json:"retry_policy"`
}

type InsertQueueParams

type InsertQueueParams struct {
	QueueName string `json:"queue_name"`
	IsFifo    bool   `json:"is_fifo"`
}

type NullGoqueueJobStatus

type NullGoqueueJobStatus struct {
	GoqueueJobStatus GoqueueJobStatus `json:"goqueue_job_status"`
	Valid            bool             `json:"valid"` // Valid is true if GoqueueJobStatus is not NULL
}

func (*NullGoqueueJobStatus) Scan

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

Scan implements the Scanner interface.

func (NullGoqueueJobStatus) Value

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

Value implements the driver Valuer interface.

type NullGoqueueRetryPolicy

type NullGoqueueRetryPolicy struct {
	GoqueueRetryPolicy GoqueueRetryPolicy `json:"goqueue_retry_policy"`
	Valid              bool               `json:"valid"` // Valid is true if GoqueueRetryPolicy is not NULL
}

func (*NullGoqueueRetryPolicy) Scan

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

Scan implements the Scanner interface.

func (NullGoqueueRetryPolicy) Value

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

Value implements the driver Valuer interface.

type Querier

type Querier interface {
	FetchJob(ctx context.Context, queueName string) (GoqueueJob, error)
	FetchJobLocked(ctx context.Context, queueName string) (GoqueueJob, error)
	GetQueue(ctx context.Context, queueName string) (GoqueueQueue, error)
	InsertJob(ctx context.Context, arg InsertJobParams) (GoqueueJob, error)
	InsertQueue(ctx context.Context, arg InsertQueueParams) (GoqueueQueue, error)
	LockQueue(ctx context.Context, hashtext string) (bool, error)
	RescheduleJob(ctx context.Context, arg RescheduleJobParams) (GoqueueJob, error)
	UpdateJob(ctx context.Context, arg UpdateJobParams) (GoqueueJob, error)
	UpdateJobFailed(ctx context.Context, arg UpdateJobFailedParams) (GoqueueJob, error)
	UpdateJobFinished(ctx context.Context, jobID int32) (GoqueueJob, error)
	UpdateJobStatus(ctx context.Context, arg UpdateJobStatusParams) (GoqueueJob, error)
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) FetchJob

func (q *Queries) FetchJob(ctx context.Context, queueName string) (GoqueueJob, error)

func (*Queries) FetchJobLocked

func (q *Queries) FetchJobLocked(ctx context.Context, queueName string) (GoqueueJob, error)

func (*Queries) GetQueue

func (q *Queries) GetQueue(ctx context.Context, queueName string) (GoqueueQueue, error)

func (*Queries) InsertJob

func (q *Queries) InsertJob(ctx context.Context, arg InsertJobParams) (GoqueueJob, error)

func (*Queries) InsertQueue

func (q *Queries) InsertQueue(ctx context.Context, arg InsertQueueParams) (GoqueueQueue, error)

func (*Queries) LockQueue

func (q *Queries) LockQueue(ctx context.Context, hashtext string) (bool, error)

func (*Queries) RescheduleJob

func (q *Queries) RescheduleJob(ctx context.Context, arg RescheduleJobParams) (GoqueueJob, error)

func (*Queries) UpdateJob

func (q *Queries) UpdateJob(ctx context.Context, arg UpdateJobParams) (GoqueueJob, error)

func (*Queries) UpdateJobFailed

func (q *Queries) UpdateJobFailed(ctx context.Context, arg UpdateJobFailedParams) (GoqueueJob, error)

func (*Queries) UpdateJobFinished

func (q *Queries) UpdateJobFinished(ctx context.Context, jobID int32) (GoqueueJob, error)

func (*Queries) UpdateJobStatus

func (q *Queries) UpdateJobStatus(ctx context.Context, arg UpdateJobStatusParams) (GoqueueJob, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type RescheduleJobParams

type RescheduleJobParams struct {
	ScheduledAt pgtype.Timestamp `json:"scheduled_at"`
	JobID       int32            `json:"job_id"`
}

type UpdateJobFailedParams

type UpdateJobFailedParams struct {
	Error pgtype.Text `json:"error"`
	JobID int32       `json:"job_id"`
}

type UpdateJobParams

type UpdateJobParams struct {
	CreatedAt  pgtype.Timestamp `json:"created_at"`
	FinishedAt pgtype.Timestamp `json:"finished_at"`
	Status     GoqueueJobStatus `json:"status"`
	Error      pgtype.Text      `json:"error"`
	Arguments  []byte           `json:"arguments"`
	JobID      int32            `json:"job_id"`
}

type UpdateJobStatusParams

type UpdateJobStatusParams struct {
	Status GoqueueJobStatus `json:"status"`
	JobID  int32            `json:"job_id"`
}

Jump to

Keyboard shortcuts

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