Help us shape the future of Go! Take the 2026 Go Developer Survey

db

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelJobParams

type CancelJobParams struct {
	ID        string             `json:"id"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

type CompleteJobLockedParams

type CompleteJobLockedParams struct {
	ID          string             `json:"id"`
	CompletedAt pgtype.Timestamptz `json:"completed_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
	LockedBy    pgtype.Text        `json:"locked_by"`
}

type CompleteJobParams

type CompleteJobParams struct {
	ID          string             `json:"id"`
	CompletedAt pgtype.Timestamptz `json:"completed_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
}

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 DeleteDeadJobParams

type DeleteDeadJobParams struct {
	ID        string             `json:"id"`
	DeletedAt pgtype.Timestamptz `json:"deleted_at"`
}

type DeleteJobParams

type DeleteJobParams struct {
	ID        string             `json:"id"`
	DeletedAt pgtype.Timestamptz `json:"deleted_at"`
}

type InsertJobParams

type InsertJobParams struct {
	ID           string             `json:"id"`
	JobType      pgtype.Text        `json:"job_type"`
	Priority     int64              `json:"priority"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
	Payload      pgtype.Text        `json:"payload"`
	Status       pgtype.Text        `json:"status"`
	CompletedAt  pgtype.Timestamptz `json:"completed_at"`
	ScheduledAt  pgtype.Timestamptz `json:"scheduled_at"`
	MaxRetries   pgtype.Int8        `json:"max_retries"`
	RetryCount   pgtype.Int8        `json:"retry_count"`
	ErrorMessage pgtype.Text        `json:"error_message"`
	LockedAt     pgtype.Timestamptz `json:"locked_at"`
	LockedBy     pgtype.Text        `json:"locked_by"`
	Timeout      pgtype.Int8        `json:"timeout"`
}

type Job

type Job struct {
	ID           string             `json:"id"`
	JobType      pgtype.Text        `json:"job_type"`
	Priority     int64              `json:"priority"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
	Payload      pgtype.Text        `json:"payload"`
	Status       pgtype.Text        `json:"status"`
	CompletedAt  pgtype.Timestamptz `json:"completed_at"`
	ScheduledAt  pgtype.Timestamptz `json:"scheduled_at"`
	MaxRetries   pgtype.Int8        `json:"max_retries"`
	RetryCount   pgtype.Int8        `json:"retry_count"`
	ErrorMessage pgtype.Text        `json:"error_message"`
	LockedAt     pgtype.Timestamptz `json:"locked_at"`
	LockedBy     pgtype.Text        `json:"locked_by"`
	Timeout      pgtype.Int8        `json:"timeout"`
}

type JobStatusCountsRow

type JobStatusCountsRow struct {
	Status pgtype.Text `json:"status"`
	Count  int64       `json:"count"`
}

type ListJobsByStatusParams

type ListJobsByStatusParams struct {
	Status pgtype.Text `json:"status"`
	Limit  int32       `json:"limit"`
	Offset int32       `json:"offset"`
}

type ListJobsByStatusTypeParams

type ListJobsByStatusTypeParams struct {
	Status  pgtype.Text `json:"status"`
	JobType pgtype.Text `json:"job_type"`
	Limit   int32       `json:"limit"`
	Offset  int32       `json:"offset"`
}

type ListJobsByTypeParams

type ListJobsByTypeParams struct {
	JobType pgtype.Text `json:"job_type"`
	Limit   int32       `json:"limit"`
	Offset  int32       `json:"offset"`
}

type ListJobsParams

type ListJobsParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type MarkJobDeadLockedParams

type MarkJobDeadLockedParams struct {
	ID           string             `json:"id"`
	ErrorMessage pgtype.Text        `json:"error_message"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	LockedBy     pgtype.Text        `json:"locked_by"`
}

type MarkJobDeadParams

type MarkJobDeadParams struct {
	ID           string             `json:"id"`
	ErrorMessage pgtype.Text        `json:"error_message"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
}

type MarkJobFailedLockedParams

type MarkJobFailedLockedParams struct {
	ID           string             `json:"id"`
	RetryCount   pgtype.Int8        `json:"retry_count"`
	ScheduledAt  pgtype.Timestamptz `json:"scheduled_at"`
	ErrorMessage pgtype.Text        `json:"error_message"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	LockedBy     pgtype.Text        `json:"locked_by"`
}

type MarkJobFailedParams

type MarkJobFailedParams struct {
	ID           string             `json:"id"`
	RetryCount   pgtype.Int8        `json:"retry_count"`
	ScheduledAt  pgtype.Timestamptz `json:"scheduled_at"`
	ErrorMessage pgtype.Text        `json:"error_message"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
}

type PurgeJobsByStatusParams

type PurgeJobsByStatusParams struct {
	Status    pgtype.Text        `json:"status"`
	DeletedAt pgtype.Timestamptz `json:"deleted_at"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CancelJob

func (q *Queries) CancelJob(ctx context.Context, arg CancelJobParams) (int64, error)

func (*Queries) CompleteJob

func (q *Queries) CompleteJob(ctx context.Context, arg CompleteJobParams) error

func (*Queries) CompleteJobLocked

func (q *Queries) CompleteJobLocked(ctx context.Context, arg CompleteJobLockedParams) (int64, error)

func (*Queries) DeadJobs

func (q *Queries) DeadJobs(ctx context.Context) ([]Job, error)

func (*Queries) DeleteAllJobs

func (q *Queries) DeleteAllJobs(ctx context.Context) error

func (*Queries) DeleteDeadJob

func (q *Queries) DeleteDeadJob(ctx context.Context, arg DeleteDeadJobParams) (int64, error)

func (*Queries) DeleteJob

func (q *Queries) DeleteJob(ctx context.Context, arg DeleteJobParams) (int64, error)

func (*Queries) GetDeadJob

func (q *Queries) GetDeadJob(ctx context.Context, id string) (Job, error)

func (*Queries) GetJob

func (q *Queries) GetJob(ctx context.Context, id string) (Job, error)

func (*Queries) InsertJob

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

func (*Queries) JobStatusCounts

func (q *Queries) JobStatusCounts(ctx context.Context) ([]JobStatusCountsRow, error)

func (*Queries) ListJobs

func (q *Queries) ListJobs(ctx context.Context, arg ListJobsParams) ([]Job, error)

func (*Queries) ListJobsByStatus

func (q *Queries) ListJobsByStatus(ctx context.Context, arg ListJobsByStatusParams) ([]Job, error)

func (*Queries) ListJobsByStatusType

func (q *Queries) ListJobsByStatusType(ctx context.Context, arg ListJobsByStatusTypeParams) ([]Job, error)

func (*Queries) ListJobsByType

func (q *Queries) ListJobsByType(ctx context.Context, arg ListJobsByTypeParams) ([]Job, error)

func (*Queries) MarkJobDead

func (q *Queries) MarkJobDead(ctx context.Context, arg MarkJobDeadParams) error

func (*Queries) MarkJobDeadLocked

func (q *Queries) MarkJobDeadLocked(ctx context.Context, arg MarkJobDeadLockedParams) (int64, error)

func (*Queries) MarkJobFailed

func (q *Queries) MarkJobFailed(ctx context.Context, arg MarkJobFailedParams) error

func (*Queries) MarkJobFailedLocked

func (q *Queries) MarkJobFailedLocked(ctx context.Context, arg MarkJobFailedLockedParams) (int64, error)

func (*Queries) PurgeJobsByStatus

func (q *Queries) PurgeJobsByStatus(ctx context.Context, arg PurgeJobsByStatusParams) (int64, error)

func (*Queries) QueryPendingJobs

func (q *Queries) QueryPendingJobs(ctx context.Context) ([]Job, error)

func (*Queries) ResetJob

func (q *Queries) ResetJob(ctx context.Context, arg ResetJobParams) (Job, error)

func (*Queries) ResetStaleJob

func (q *Queries) ResetStaleJob(ctx context.Context, arg ResetStaleJobParams) error

func (*Queries) RetryAllDeadJobs

func (q *Queries) RetryAllDeadJobs(ctx context.Context, updatedAt pgtype.Timestamptz) (int64, error)

func (*Queries) RetryDeadJob

func (q *Queries) RetryDeadJob(ctx context.Context, arg RetryDeadJobParams) (Job, error)

func (*Queries) ScheduledJobs

func (q *Queries) ScheduledJobs(ctx context.Context, scheduledAt pgtype.Timestamptz) ([]Job, error)

func (*Queries) SetJobRunning

func (q *Queries) SetJobRunning(ctx context.Context, arg SetJobRunningParams) error

func (*Queries) StaleJobs

func (q *Queries) StaleJobs(ctx context.Context, lockedAt pgtype.Timestamptz) ([]Job, error)

func (*Queries) WithTx

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

type ResetJobParams

type ResetJobParams struct {
	ID        string             `json:"id"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

type ResetStaleJobParams

type ResetStaleJobParams struct {
	ID        string             `json:"id"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

type RetryDeadJobParams

type RetryDeadJobParams struct {
	ID        string             `json:"id"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

type SetJobRunningParams

type SetJobRunningParams struct {
	ID        string             `json:"id"`
	LockedAt  pgtype.Timestamptz `json:"locked_at"`
	LockedBy  pgtype.Text        `json:"locked_by"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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