authz

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTransactionInContext = errors.New("authz datastore: active pgx.Tx required in context")

ErrNoTransactionInContext is returned by ReadPage and Write when called without an active pgx.Tx injected via ContextWithTx.

Functions

func ContextWithTx

func ContextWithTx(ctx context.Context, tx pgx.Tx) context.Context

ContextWithTx injects an active pgx.Tx into ctx.

func EnsureStoreAndModel

func EnsureStoreAndModel(ctx context.Context, pool *pgxpool.Pool, fgaServer *server.Server) (string, string, error)

EnsureStoreAndModel ensures the default OpenFGA store and checked-in authorization model are provisioned on fgaServer (serialized across replicas via a PostgreSQL advisory lock on pool) and returns the provisioned (storeID, modelID).

func NewOpenFGAServer

func NewOpenFGAServer(pool *pgxpool.Pool) (*server.Server, error)

NewOpenFGAServer creates an embedded OpenFGA server backed by a transaction-aware PostgreSQL datastore on pool. Calling Close on the returned server stops OpenFGA's background workers without closing the caller-owned pool.

func TxFromContext

func TxFromContext(ctx context.Context) (pgx.Tx, bool)

TxFromContext retrieves the active pgx.Tx from ctx, if present.

Types

This section is empty.

Jump to

Keyboard shortcuts

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