postgres

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package postgres provides durable atomic capability consumption through database/sql and PostgreSQL row locks. The caller supplies the SQL driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumptionStore

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

ConsumptionStore owns durable PostgreSQL transactions for replay state.

func NewConsumptionStore

func NewConsumptionStore(db *sql.DB) (*ConsumptionStore, error)

NewConsumptionStore binds store to db. The schema in migrations must be installed before use. db remains caller-owned and is never closed here.

func (*ConsumptionStore) Cleanup

func (store *ConsumptionStore) Cleanup(ctx context.Context, cutoff time.Time) (int64, error)

Cleanup deletes state whose expiry is at or before cutoff.

func (*ConsumptionStore) Consume

Consume serializes one capability row, then commits an increment only when the signed identity and use bound match. Commit errors have unknown outcome.

Directories

Path Synopsis
identity module

Jump to

Keyboard shortcuts

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