postgres

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

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
}

func NewPostgresDatastore

func NewPostgresDatastore(uri string, opts ...PostgresOption) (*Postgres, error)

func (*Postgres) Close

func (p *Postgres) Close(ctx context.Context) error

Close closes any open connections and cleans up residual resources used by this storage adapter instance.

func (*Postgres) CreateStore

func (p *Postgres) CreateStore(ctx context.Context, store *openfgapb.Store) (*openfgapb.Store, error)

func (*Postgres) DeleteStore

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

func (*Postgres) FindLatestAuthorizationModelID

func (p *Postgres) FindLatestAuthorizationModelID(ctx context.Context, store string) (string, error)

func (*Postgres) GetStore

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

func (*Postgres) IsReady added in v0.1.5

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

IsReady reports whether this Postgres datastore instance is ready to accept connections.

func (*Postgres) ListObjectsByType added in v0.2.0

func (p *Postgres) ListObjectsByType(ctx context.Context, store string, objectType string) (storage.ObjectIterator, error)

func (*Postgres) ListStores

func (p *Postgres) ListStores(ctx context.Context, opts storage.PaginationOptions) ([]*openfgapb.Store, []byte, error)

func (*Postgres) MaxTuplesInWriteOperation

func (p *Postgres) MaxTuplesInWriteOperation() int

func (*Postgres) MaxTypesInTypeDefinition

func (p *Postgres) MaxTypesInTypeDefinition() int

func (*Postgres) Read

func (p *Postgres) Read(ctx context.Context, store string, tupleKey *openfgapb.TupleKey) (storage.TupleIterator, error)

func (*Postgres) ReadAssertions

func (p *Postgres) ReadAssertions(ctx context.Context, store, modelID string) ([]*openfgapb.Assertion, error)

func (*Postgres) ReadAuthorizationModel

func (p *Postgres) ReadAuthorizationModel(ctx context.Context, store string, modelID string) (*openfgapb.AuthorizationModel, error)

func (*Postgres) ReadAuthorizationModels

func (p *Postgres) ReadAuthorizationModels(ctx context.Context, store string, opts storage.PaginationOptions) ([]*openfgapb.AuthorizationModel, []byte, error)

func (*Postgres) ReadByStore

func (p *Postgres) ReadByStore(ctx context.Context, store string, opts storage.PaginationOptions) ([]*openfgapb.Tuple, []byte, error)

func (*Postgres) ReadChanges

func (p *Postgres) ReadChanges(
	ctx context.Context,
	store, objectTypeFilter string,
	opts storage.PaginationOptions,
	horizonOffset time.Duration,
) ([]*openfgapb.TupleChange, []byte, error)

func (*Postgres) ReadPage

func (p *Postgres) ReadPage(ctx context.Context, store string, tupleKey *openfgapb.TupleKey, opts storage.PaginationOptions) ([]*openfgapb.Tuple, []byte, error)

func (*Postgres) ReadTypeDefinition

func (p *Postgres) ReadTypeDefinition(
	ctx context.Context,
	store, modelID, objectType string,
) (*openfgapb.TypeDefinition, error)

func (*Postgres) ReadUserTuple

func (p *Postgres) ReadUserTuple(ctx context.Context, store string, tupleKey *openfgapb.TupleKey) (*openfgapb.Tuple, error)

func (*Postgres) ReadUsersetTuples

func (p *Postgres) ReadUsersetTuples(ctx context.Context, store string, tupleKey *openfgapb.TupleKey) (storage.TupleIterator, error)

func (*Postgres) Write

func (p *Postgres) Write(ctx context.Context, store string, deletes storage.Deletes, writes storage.Writes) error

func (*Postgres) WriteAssertions

func (p *Postgres) WriteAssertions(ctx context.Context, store, modelID string, assertions []*openfgapb.Assertion) error

func (*Postgres) WriteAuthorizationModel

func (p *Postgres) WriteAuthorizationModel(
	ctx context.Context,
	store, modelID string,
	tds []*openfgapb.TypeDefinition,
) error

type PostgresOption

type PostgresOption func(*Postgres)

func WithLogger

func WithLogger(l logger.Logger) PostgresOption

func WithMaxTuplesInWrite

func WithMaxTuplesInWrite(maxTuples int) PostgresOption

func WithMaxTypesInTypeDefinition

func WithMaxTypesInTypeDefinition(maxTypes int) PostgresOption

func WithTracer

func WithTracer(t trace.Tracer) PostgresOption

Jump to

Keyboard shortcuts

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