postgres

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DialectPostgres = sqlutil.DialectPostgres
	DialectSQLite   = sqlutil.DialectSQLite
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect = sqlutil.Dialect

Dialect controls SQL placeholder formatting.

type Option

type Option func(*Store)

Option configures the postgres cancellation store.

func WithBatchSize

func WithBatchSize(size int) Option

WithBatchSize configures subscription batch size.

func WithClock

func WithClock(now func() time.Time) Option

WithClock overrides the time source.

func WithDialect

func WithDialect(dialect Dialect) Option

WithDialect sets the SQL placeholder style.

func WithPollInterval

func WithPollInterval(interval time.Duration) Option

WithPollInterval configures subscription polling interval.

func WithTableName

func WithTableName(name string) Option

WithTableName sets the table name.

type Store

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

Store implements cancellation.Store backed by SQL.

func NewStore

func NewStore(db *sql.DB, opts ...Option) *Store

NewStore builds a postgres cancellation store.

func (*Store) Cleanup

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

Cleanup drops the cancellation table (for tests).

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) (cancellation.Request, bool, error)

Get retrieves a cancellation request by key.

func (*Store) Migrate

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

Migrate creates the cancellation table.

func (*Store) Request

func (s *Store) Request(ctx context.Context, req cancellation.Request) error

Request upserts a cancellation request.

func (*Store) Subscribe

func (s *Store) Subscribe(ctx context.Context) (<-chan cancellation.Request, error)

Subscribe returns a channel that emits cancellation requests.

Jump to

Keyboard shortcuts

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