Versions in this module Expand all Collapse all v0 v0.1.45 Jul 16, 2026 v0.1.44 Jul 16, 2026 Changes in this version + var ErrUnauthenticated = errors.New("postgres scope requires an authenticated principal") + var ErrUnauthorized = errors.New("postgres write capability is not authorized") + type Authenticator interface + AuthenticatedPrincipal func(context.Context) (Principal, error) + AuthorizeDatabaseWrite func(context.Context, Principal) error + type Factory struct + func NewFactory(reader, writer *pgxpool.Pool, authenticator Authenticator, options ...Option) (*Factory, error) + func (f *Factory) Reader(ctx context.Context) (*Reader, error) + func (f *Factory) Writer(ctx context.Context) (*Writer, error) + type Option func(*config) error + func WithScopeSettings(tenantSetting, userSetting string) Option + type Principal interface + DatabaseTenantID func() string + DatabaseUserID func() string + type ReadTx interface + Query func(context.Context, string, ...any) (pgx.Rows, error) + QueryRow func(context.Context, string, ...any) pgx.Row + type Reader struct + func (r *Reader) InTransaction(ctx context.Context, fn func(context.Context, ReadTx) error) error + type WriteTx interface + Exec func(context.Context, string, ...any) (pgconn.CommandTag, error) + type Writer struct + func (w *Writer) InTransaction(ctx context.Context, fn func(context.Context, WriteTx) error) error