postgres

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package postgres contains an implementation of the storage interface that works with Postgres.

Index

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 New

func New(uri string, cfg *sqlcommon.Config) (*Postgres, error)

New creates a new Postgres storage.

func (*Postgres) Close

func (p *Postgres) Close()

Close see storage.OpenFGADatastore.Close.

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

func (p *Postgres) DeleteStore(ctx context.Context, id string) error

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

func (p *Postgres) GetStore(ctx context.Context, id string) (*openfgav1.Store, error)

GetStore retrieves the details of a specific store from the Postgres using its storeID.

func (*Postgres) IsReady

func (p *Postgres) IsReady(ctx context.Context) (storage.ReadinessStatus, error)

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

func (p *Postgres) MaxTuplesPerWrite() int

MaxTuplesPerWrite see storage.RelationshipTupleWriter.MaxTuplesPerWrite.

func (*Postgres) MaxTypesPerAuthorizationModel

func (p *Postgres) MaxTypesPerAuthorizationModel() int

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.

Jump to

Keyboard shortcuts

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