Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthzError ¶
type AuthzError struct {
// Op is the operation that caused the error.
Op string
// Err is the error that occurred.
Err error
}
AuthzError is an error that occurred while executing a query.
func NewQueryError ¶
func NewQueryError(op string, err error) *AuthzError
NewQueryError returns a new QueryError.
func (*AuthzError) Error ¶
func (e *AuthzError) Error() string
Error implements the error interface.
func (*AuthzError) Unwrap ¶
func (e *AuthzError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type Store ¶
type Store[Tx any] interface { // Allowed checks if the user is allowed to perform the operation on the object. Allowed(context.Context, User, Object, Relation) (bool, error) // WriteTx starts a read write transaction. WriteTx(context.Context, func(context.Context, Tx) error) error }
Store is an interface that provides methods for transactional operations on the authz database.
func NewStore ¶
func NewStore[Tx any](client *client.OpenFgaClient, tx StoreTxFactory[Tx]) (Store[Tx], error)
NewStore returns a new instance of authz store.
type StoreTx ¶
type StoreTx interface {
// WriteTuple writes a tuple to the authz database.
WriteTuple(context.Context, User, Object, Relation) error
// DeleteTuple deletes a tuple from the authz database.
DeleteTuple(context.Context, User, Object, Relation) error
}
StoreTx is an interface that provides methods for transactional operations on the authz database.
type StoreTxFactory ¶
type StoreTxFactory[Tx any] func(*client.OpenFgaClient, StoreTx) (Tx, error)
StoreTxFactory is a function that creates a new instance of authz store.
Click to show internal directories.
Click to hide internal directories.