Documentation
¶
Overview ¶
Package sqlite contains an implementation of the storage interface that works with SQLite.
Index ¶
- func PrepareDSN(uri string) (string, error)
- type SQLTupleIterator
- type SQLite
- func (m *SQLite) Close()
- func (m *SQLite) CreateStore(ctx context.Context, store *openfgav1.Store) (*openfgav1.Store, error)
- func (m *SQLite) DeleteStore(ctx context.Context, id string) error
- func (m *SQLite) FindLatestAuthorizationModel(ctx context.Context, store string) (*openfgav1.AuthorizationModel, error)
- func (m *SQLite) GetStore(ctx context.Context, id string) (*openfgav1.Store, error)
- func (m *SQLite) IsReady(ctx context.Context) (storage.ReadinessStatus, error)
- func (m *SQLite) ListStores(ctx context.Context, options storage.ListStoresOptions) ([]*openfgav1.Store, []byte, error)
- func (m *SQLite) MaxTuplesPerWrite() int
- func (m *SQLite) MaxTypesPerAuthorizationModel() int
- func (m *SQLite) Read(ctx context.Context, store string, tupleKey *openfgav1.TupleKey, ...) (storage.TupleIterator, error)
- func (m *SQLite) ReadAssertions(ctx context.Context, store, modelID string) ([]*openfgav1.Assertion, error)
- func (m *SQLite) ReadAuthorizationModel(ctx context.Context, store string, modelID string) (*openfgav1.AuthorizationModel, error)
- func (m *SQLite) ReadAuthorizationModels(ctx context.Context, store string, ...) ([]*openfgav1.AuthorizationModel, []byte, error)
- func (m *SQLite) ReadChanges(ctx context.Context, store, objectTypeFilter string, ...) ([]*openfgav1.TupleChange, []byte, error)
- func (m *SQLite) ReadPage(ctx context.Context, store string, tupleKey *openfgav1.TupleKey, ...) ([]*openfgav1.Tuple, []byte, error)
- func (m *SQLite) ReadStartingWithUser(ctx context.Context, store string, filter storage.ReadStartingWithUserFilter, ...) (storage.TupleIterator, error)
- func (m *SQLite) ReadUserTuple(ctx context.Context, store string, tupleKey *openfgav1.TupleKey, ...) (*openfgav1.Tuple, error)
- func (m *SQLite) ReadUsersetTuples(ctx context.Context, store string, filter storage.ReadUsersetTuplesFilter, ...) (storage.TupleIterator, error)
- func (m *SQLite) Write(ctx context.Context, store string, deletes storage.Deletes, ...) error
- func (m *SQLite) WriteAssertions(ctx context.Context, store, modelID string, assertions []*openfgav1.Assertion) error
- func (m *SQLite) WriteAuthorizationModel(ctx context.Context, store string, model *openfgav1.AuthorizationModel) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepareDSN ¶
Prepare a raw DSN from config for use with SQLite, specifying defaults for journal mode and busy timeout.
Types ¶
type SQLTupleIterator ¶
type SQLTupleIterator struct {
// contains filtered or unexported fields
}
SQLTupleIterator is a struct that implements the storage.TupleIterator interface for iterating over tuples fetched from a SQL database.
func NewSQLTupleIterator ¶
func NewSQLTupleIterator(rows *sql.Rows) *SQLTupleIterator
NewSQLTupleIterator returns a SQL tuple iterator.
func (*SQLTupleIterator) ToArray ¶
func (t *SQLTupleIterator) ToArray( opts storage.PaginationOptions, ) ([]*openfgav1.Tuple, []byte, error)
ToArray converts the tupleIterator to an []*openfgav1.Tuple and a possibly empty continuation token. If the continuation token exists it is the ulid of the last element of the returned array.
type SQLite ¶
type SQLite struct {
// contains filtered or unexported fields
}
SQLite provides a SQLite based implementation of storage.OpenFGADatastore.
func (*SQLite) CreateStore ¶
CreateStore adds a new store to the SQLite storage.
func (*SQLite) DeleteStore ¶
DeleteStore removes a store from the SQLite storage.
func (*SQLite) FindLatestAuthorizationModel ¶
func (m *SQLite) FindLatestAuthorizationModel(ctx context.Context, store string) (*openfgav1.AuthorizationModel, error)
FindLatestAuthorizationModel see storage.AuthorizationModelReadBackend.FindLatestAuthorizationModel.
func (*SQLite) GetStore ¶
GetStore retrieves the details of a specific store from the SQLite using its storeID.
func (*SQLite) IsReady ¶
IsReady see sqlcommon.IsReady.
func (*SQLite) ListStores ¶
func (m *SQLite) ListStores(ctx context.Context, options storage.ListStoresOptions) ([]*openfgav1.Store, []byte, error)
ListStores provides a paginated list of all stores present in the SQLite storage.
func (*SQLite) MaxTuplesPerWrite ¶
MaxTuplesPerWrite see storage.RelationshipTupleWriter.MaxTuplesPerWrite.
func (*SQLite) MaxTypesPerAuthorizationModel ¶
MaxTypesPerAuthorizationModel see storage.TypeDefinitionWriteBackend.MaxTypesPerAuthorizationModel.
func (*SQLite) Read ¶
func (m *SQLite) Read(ctx context.Context, store string, tupleKey *openfgav1.TupleKey, _ storage.ReadOptions) (storage.TupleIterator, error)
Read see storage.RelationshipTupleReader.Read.
func (*SQLite) ReadAssertions ¶
func (m *SQLite) ReadAssertions(ctx context.Context, store, modelID string) ([]*openfgav1.Assertion, error)
ReadAssertions see storage.AssertionsBackend.ReadAssertions.
func (*SQLite) ReadAuthorizationModel ¶
func (m *SQLite) ReadAuthorizationModel(ctx context.Context, store string, modelID string) (*openfgav1.AuthorizationModel, error)
ReadAuthorizationModel see storage.AuthorizationModelReadBackend.ReadAuthorizationModel.
func (*SQLite) ReadAuthorizationModels ¶
func (m *SQLite) ReadAuthorizationModels( ctx context.Context, store string, options storage.ReadAuthorizationModelsOptions, ) ([]*openfgav1.AuthorizationModel, []byte, error)
ReadAuthorizationModels see storage.AuthorizationModelReadBackend.ReadAuthorizationModels.
func (*SQLite) ReadChanges ¶
func (m *SQLite) ReadChanges( ctx context.Context, store, objectTypeFilter string, options storage.ReadChangesOptions, horizonOffset time.Duration, ) ([]*openfgav1.TupleChange, []byte, error)
ReadChanges see storage.ChangelogBackend.ReadChanges.
func (*SQLite) ReadPage ¶
func (m *SQLite) ReadPage( ctx context.Context, store string, tupleKey *openfgav1.TupleKey, options storage.ReadPageOptions, ) ([]*openfgav1.Tuple, []byte, error)
ReadPage see storage.RelationshipTupleReader.ReadPage.
func (*SQLite) ReadStartingWithUser ¶
func (m *SQLite) ReadStartingWithUser( ctx context.Context, store string, filter storage.ReadStartingWithUserFilter, _ storage.ReadStartingWithUserOptions, ) (storage.TupleIterator, error)
ReadStartingWithUser see storage.RelationshipTupleReader.ReadStartingWithUser.
func (*SQLite) ReadUserTuple ¶
func (m *SQLite) ReadUserTuple(ctx context.Context, store string, tupleKey *openfgav1.TupleKey, _ storage.ReadUserTupleOptions) (*openfgav1.Tuple, error)
ReadUserTuple see storage.RelationshipTupleReader.ReadUserTuple.
func (*SQLite) ReadUsersetTuples ¶
func (m *SQLite) ReadUsersetTuples( ctx context.Context, store string, filter storage.ReadUsersetTuplesFilter, _ storage.ReadUsersetTuplesOptions, ) (storage.TupleIterator, error)
ReadUsersetTuples see storage.RelationshipTupleReader.ReadUsersetTuples.
func (*SQLite) Write ¶
func (m *SQLite) Write(ctx context.Context, store string, deletes storage.Deletes, writes storage.Writes) error
Write see storage.RelationshipTupleWriter.Write.
func (*SQLite) WriteAssertions ¶
func (m *SQLite) WriteAssertions(ctx context.Context, store, modelID string, assertions []*openfgav1.Assertion) error
WriteAssertions see storage.AssertionsBackend.WriteAssertions.
func (*SQLite) WriteAuthorizationModel ¶
func (m *SQLite) WriteAuthorizationModel(ctx context.Context, store string, model *openfgav1.AuthorizationModel) error
WriteAuthorizationModel see storage.TypeDefinitionWriteBackend.WriteAuthorizationModel.