Documentation
¶
Index ¶
- Variables
- func ContextWithTx(ctx context.Context, tx pgx.Tx) context.Context
- func EnsureStoreAndModel(ctx context.Context, pool *pgxpool.Pool, fgaServer *server.Server) (string, string, error)
- func NewOpenFGAServer(pool *pgxpool.Pool) (*server.Server, error)
- func TxFromContext(ctx context.Context) (pgx.Tx, bool)
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 ¶
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 ¶
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.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.