postgres

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Slug    string    `db:"slug"`
	Kind    string    `db:"kind"`
	Payload []byte    `db:"payload"`
	When    time.Time `db:"run_at"`
	Version int64     `db:"version"`
	Retry   int       `db:"retry"`
	Result  string    `db:"result"`
}

type Store

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

Store is a PostgreSQL task store.

func New

func New(db *sql.DB, options ...StoreOption) *Store

func (*Store) Clear

func (s *Store) Clear(ctx context.Context) error

func (*Store) Create

func (s *Store) Create(ctx context.Context, task *scheduler.StoreTask) error

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, slug string) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, slug string) (*scheduler.StoreTask, error)

func (*Store) GetSlugs

func (s *Store) GetSlugs(ctx context.Context) ([]string, error)

func (*Store) Lock

func (s *Store) Lock(ctx context.Context, task *scheduler.StoreTask) (*scheduler.StoreTask, error)

func (*Store) NextRun

func (s *Store) NextRun(ctx context.Context) (*scheduler.StoreTask, error)

NextRun returns the next available run

func (*Store) Reschedule

func (s *Store) Reschedule(ctx context.Context, task *scheduler.StoreTask) error

type StoreOption

type StoreOption func(*Store)

func TableOption

func TableOption(tableName string) StoreOption

Jump to

Keyboard shortcuts

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