Documentation ¶
Overview ¶
Package postgres contains an implementation of the storage interface that works with Postgres.
Index ¶
- type Postgres
- func (p *Postgres) Close()
- func (p *Postgres) CreateStore(ctx context.Context, store *openfgav1.Store) (*openfgav1.Store, error)
- func (p *Postgres) DeleteStore(ctx context.Context, id string) error
- func (p *Postgres) FindLatestAuthorizationModel(ctx context.Context, store string) (*openfgav1.AuthorizationModel, error)
- func (p *Postgres) GetStore(ctx context.Context, id string) (*openfgav1.Store, error)
- func (p *Postgres) IsReady(ctx context.Context) (storage.ReadinessStatus, error)
- func (p *Postgres) ListStores(ctx context.Context, opts storage.PaginationOptions) ([]*openfgav1.Store, []byte, error)
- func (p *Postgres) MaxTuplesPerWrite() int
- func (p *Postgres) MaxTypesPerAuthorizationModel() int
- func (p *Postgres) Read(ctx context.Context, store string, tupleKey *openfgav1.TupleKey) (storage.TupleIterator, error)
- func (p *Postgres) ReadAssertions(ctx context.Context, store, modelID string) ([]*openfgav1.Assertion, error)
- func (p *Postgres) ReadAuthorizationModel(ctx context.Context, store string, modelID string) (*openfgav1.AuthorizationModel, error)
- func (p *Postgres) ReadAuthorizationModels(ctx context.Context, store string, opts storage.PaginationOptions) ([]*openfgav1.AuthorizationModel, []byte, error)
- func (p *Postgres) ReadChanges(ctx context.Context, store, objectTypeFilter string, ...) ([]*openfgav1.TupleChange, []byte, error)
- func (p *Postgres) ReadPage(ctx context.Context, store string, tupleKey *openfgav1.TupleKey, ...) ([]*openfgav1.Tuple, []byte, error)
- func (p *Postgres) ReadStartingWithUser(ctx context.Context, store string, opts storage.ReadStartingWithUserFilter) (storage.TupleIterator, error)
- func (p *Postgres) ReadUserTuple(ctx context.Context, store string, tupleKey *openfgav1.TupleKey) (*openfgav1.Tuple, error)
- func (p *Postgres) ReadUsersetTuples(ctx context.Context, store string, filter storage.ReadUsersetTuplesFilter) (storage.TupleIterator, error)
- func (p *Postgres) Write(ctx context.Context, store string, deletes storage.Deletes, ...) error
- func (p *Postgres) WriteAssertions(ctx context.Context, store, modelID string, assertions []*openfgav1.Assertion) error
- func (p *Postgres) WriteAuthorizationModel(ctx context.Context, store string, model *openfgav1.AuthorizationModel) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
Postgres provides a Postgres based implementation of storage.OpenFGADatastore.
func (*Postgres) CreateStore ¶
func (p *Postgres) CreateStore(ctx context.Context, store *openfgav1.Store) (*openfgav1.Store, error)
CreateStore adds a new store to the Postgres storage.
func (*Postgres) DeleteStore ¶
DeleteStore removes a store from the Postgres storage.
func (*Postgres) FindLatestAuthorizationModel ¶ added in v1.5.0
func (p *Postgres) FindLatestAuthorizationModel(ctx context.Context, store string) (*openfgav1.AuthorizationModel, error)
FindLatestAuthorizationModel see storage.AuthorizationModelReadBackend.FindLatestAuthorizationModel.
func (*Postgres) GetStore ¶
GetStore retrieves the details of a specific store from the Postgres using its storeID.
func (*Postgres) IsReady ¶
IsReady see sqlcommon.IsReady.
func (*Postgres) ListStores ¶
func (p *Postgres) ListStores(ctx context.Context, opts storage.PaginationOptions) ([]*openfgav1.Store, []byte, error)
ListStores provides a paginated list of all stores present in the Postgres storage.
func (*Postgres) MaxTuplesPerWrite ¶
MaxTuplesPerWrite see storage.RelationshipTupleWriter.MaxTuplesPerWrite.
func (*Postgres) MaxTypesPerAuthorizationModel ¶
MaxTypesPerAuthorizationModel see storage.TypeDefinitionWriteBackend.MaxTypesPerAuthorizationModel.
func (*Postgres) Read ¶
func (p *Postgres) Read(ctx context.Context, store string, tupleKey *openfgav1.TupleKey) (storage.TupleIterator, error)
Read see storage.RelationshipTupleReader.Read.
func (*Postgres) ReadAssertions ¶
func (p *Postgres) ReadAssertions(ctx context.Context, store, modelID string) ([]*openfgav1.Assertion, error)
ReadAssertions see storage.AssertionsBackend.ReadAssertions.
func (*Postgres) ReadAuthorizationModel ¶
func (p *Postgres) ReadAuthorizationModel(ctx context.Context, store string, modelID string) (*openfgav1.AuthorizationModel, error)
ReadAuthorizationModel see storage.AuthorizationModelReadBackend.ReadAuthorizationModel.
func (*Postgres) ReadAuthorizationModels ¶
func (p *Postgres) ReadAuthorizationModels(ctx context.Context, store string, opts storage.PaginationOptions) ([]*openfgav1.AuthorizationModel, []byte, error)
ReadAuthorizationModels see storage.AuthorizationModelReadBackend.ReadAuthorizationModels.
func (*Postgres) ReadChanges ¶
func (p *Postgres) ReadChanges( ctx context.Context, store, objectTypeFilter string, opts storage.PaginationOptions, horizonOffset time.Duration, ) ([]*openfgav1.TupleChange, []byte, error)
ReadChanges see storage.ChangelogBackend.ReadChanges.
func (*Postgres) ReadPage ¶
func (p *Postgres) ReadPage(ctx context.Context, store string, tupleKey *openfgav1.TupleKey, opts storage.PaginationOptions) ([]*openfgav1.Tuple, []byte, error)
ReadPage see storage.RelationshipTupleReader.ReadPage.
func (*Postgres) ReadStartingWithUser ¶
func (p *Postgres) ReadStartingWithUser(ctx context.Context, store string, opts storage.ReadStartingWithUserFilter) (storage.TupleIterator, error)
ReadStartingWithUser see storage.RelationshipTupleReader.ReadStartingWithUser.
func (*Postgres) ReadUserTuple ¶
func (p *Postgres) ReadUserTuple(ctx context.Context, store string, tupleKey *openfgav1.TupleKey) (*openfgav1.Tuple, error)
ReadUserTuple see storage.RelationshipTupleReader.ReadUserTuple.
func (*Postgres) ReadUsersetTuples ¶
func (p *Postgres) ReadUsersetTuples(ctx context.Context, store string, filter storage.ReadUsersetTuplesFilter) (storage.TupleIterator, error)
ReadUsersetTuples see storage.RelationshipTupleReader.ReadUsersetTuples.
func (*Postgres) Write ¶
func (p *Postgres) Write(ctx context.Context, store string, deletes storage.Deletes, writes storage.Writes) error
Write see storage.RelationshipTupleWriter.Write.
func (*Postgres) WriteAssertions ¶
func (p *Postgres) WriteAssertions(ctx context.Context, store, modelID string, assertions []*openfgav1.Assertion) error
WriteAssertions see storage.AssertionsBackend.WriteAssertions.
func (*Postgres) WriteAuthorizationModel ¶
func (p *Postgres) WriteAuthorizationModel(ctx context.Context, store string, model *openfgav1.AuthorizationModel) error
WriteAuthorizationModel see storage.TypeDefinitionWriteBackend.WriteAuthorizationModel.