pgq

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host     string `mapstructure:"host" default:"localhost"`
	Port     int    `mapstructure:"port" default:"5432"`
	Name     string `mapstructure:"name" default:"postgres"`
	Username string `mapstructure:"username" default:"root"`
	Password string `mapstructure:"password" default:""`

	// Connection pool settings
	MaxOpenConns          int           `mapstructure:"max_open_conns" default:"10"`
	MaxIdleConns          int           `mapstructure:"max_idle_conns" default:"4"`
	ConnMaxIdleTime       time.Duration `mapstructure:"conn_max_idle_time" default:"5m"`
	ConnMaxLifetime       time.Duration `mapstructure:"conn_max_lifetime" default:"5m"`
	ConnMaxLifetimeJitter time.Duration `mapstructure:"conn_max_lifetime_jitter" default:"2m"`
}

func (Config) ConnMaxLifetimeWithJitter

func (c Config) ConnMaxLifetimeWithJitter() time.Duration

func (Config) ConnectionString

func (c Config) ConnectionString() string

func (Config) ConnectionURL

func (c Config) ConnectionURL() string

type Processor

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

Processor implements a JobProcessor backed by PostgreSQL.

func NewProcessor

func NewProcessor(ctx context.Context, cfg Config) (*Processor, error)

NewProcessor returns a JobProcessor implementation backed by the PostgreSQL instance identified by the provided config.

func (*Processor) ClearDeadJobs

func (p *Processor) ClearDeadJobs(ctx context.Context, jobIDs []string) error

func (*Processor) Close

func (p *Processor) Close() error

func (*Processor) DeadJobs

func (p *Processor) DeadJobs(ctx context.Context, size, offset int) ([]worker.Job, error)

func (*Processor) Enqueue

func (p *Processor) Enqueue(ctx context.Context, jobs ...worker.Job) error

func (*Processor) GetSyncJobsByService added in v0.7.0

func (p *Processor) GetSyncJobsByService(ctx context.Context, service string) ([]worker.Job, error)

func (*Processor) Process

func (p *Processor) Process(ctx context.Context, types []string, fn worker.JobExecutorFunc) error

func (*Processor) Resurrect

func (p *Processor) Resurrect(ctx context.Context, jobIDs []string) error

func (*Processor) Stats

func (p *Processor) Stats(ctx context.Context) ([]worker.JobTypeStats, error)

Jump to

Keyboard shortcuts

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