database

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 8 Imported by: 1

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 EnqueueParams

type EnqueueParams struct {
	Queue    string
	JobType  string
	Priority int16
	RunAt    time.Time
	Payload  []byte
	Metadata []byte
}

type GetTasksByStatusAndQueueNameParams

type GetTasksByStatusAndQueueNameParams struct {
	Queue   string
	Column2 []string
	Limit   int32
	Offset  int32
}

type GetTotalInfoByNameHistoryRow

type GetTotalInfoByNameHistoryRow struct {
	Queue    string
	Date     time.Time
	Status   JobStatus
	Cnt      int64
	ErrCount int64
}

type GetTotalInfoByNameRow

type GetTotalInfoByNameRow struct {
	Queue    string
	Status   JobStatus
	Cnt      int64
	ErrCount int64
}

type GetTotalInfoHistoryRow

type GetTotalInfoHistoryRow struct {
	Queue    string
	Date     time.Time
	Status   JobStatus
	Cnt      int64
	ErrCount int64
}

type GetTotalInfoRow

type GetTotalInfoRow struct {
	Queue  string
	Status JobStatus
	Cnt    int64
}

type GetTotalInfoWithErrorsRow

type GetTotalInfoWithErrorsRow struct {
	Queue string
	Cnt   int64
}

type Job

type Job struct {
	ID         int64
	Priority   int16
	RunAt      time.Time
	JobType    string
	Payload    []byte
	Metadata   []byte
	ErrorCount int32
	LastError  sql.NullString
	Queue      string
	Status     JobStatus
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

type JobStatus

type JobStatus string
const (
	JobStatusPending    JobStatus = "pending"
	JobStatusProcessing JobStatus = "processing"
	JobStatusFinished   JobStatus = "finished"
	JobStatusFailed     JobStatus = "failed"
)

func (*JobStatus) Scan

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

type NullJobStatus

type NullJobStatus struct {
	JobStatus JobStatus
	Valid     bool // Valid is true if JobStatus is not NULL
}

func (*NullJobStatus) Scan

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

Scan implements the Scanner interface.

func (NullJobStatus) Value

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

Value implements the driver Valuer interface.

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) Enqueue

func (q *Queries) Enqueue(ctx context.Context, arg EnqueueParams) error

func (*Queries) GetJob

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

func (*Queries) GetTasksByStatusAndQueueName

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

func (*Queries) GetTotalInfo

func (q *Queries) GetTotalInfo(ctx context.Context) ([]GetTotalInfoRow, error)

func (*Queries) GetTotalInfoByName

func (q *Queries) GetTotalInfoByName(ctx context.Context, queue string) ([]GetTotalInfoByNameRow, error)

func (*Queries) GetTotalInfoByNameHistory

func (q *Queries) GetTotalInfoByNameHistory(ctx context.Context, queue string) ([]GetTotalInfoByNameHistoryRow, error)

func (*Queries) GetTotalInfoHistory

func (q *Queries) GetTotalInfoHistory(ctx context.Context) ([]GetTotalInfoHistoryRow, error)

func (*Queries) GetTotalInfoWithErrors

func (q *Queries) GetTotalInfoWithErrors(ctx context.Context) ([]GetTotalInfoWithErrorsRow, error)

func (*Queries) JobToProcessing

func (q *Queries) JobToProcessing(ctx context.Context, dollar_1 []int64) error

func (*Queries) Pool

func (q *Queries) Pool() *pgxpool.Pool

func (*Queries) UpdateStatus

func (q *Queries) UpdateStatus(ctx context.Context, arg UpdateStatusParams) error

func (*Queries) UpdateStatusError

func (q *Queries) UpdateStatusError(ctx context.Context, arg UpdateStatusErrorParams) error

func (*Queries) WithTx

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

type UpdateStatusErrorParams

type UpdateStatusErrorParams struct {
	ErrorCount int32
	RunAt      time.Time
	LastError  sql.NullString
	ID         int64
}

type UpdateStatusParams

type UpdateStatusParams struct {
	ID        int64
	Status    JobStatus
	LastError sql.NullString
}

Jump to

Keyboard shortcuts

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