storage

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(conf config.Database, l logger.Interface) (err error)

Migrate - migrate the database

Types

type RelationTuple

type RelationTuple struct {
	ID              uint64
	TenantID        string
	EntityType      string
	EntityID        string
	Relation        string
	SubjectType     string
	SubjectID       string
	SubjectRelation string
}

RelationTuple - Structure for Relational Tuple

func (RelationTuple) ToTuple

func (r RelationTuple) ToTuple() *base.Tuple

ToTuple - Convert database relation tuple to base relation tuple

type RelationshipReader

type RelationshipReader interface {
	// QueryRelationships reads relation tuples from the repository.
	QueryRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter, snap string) (iterator *database.TupleIterator, err error)
	// ReadRelationships reads relation tuples from the repository with different options.
	ReadRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter, snap string, pagination database.Pagination) (collection *database.TupleCollection, ct database.EncodedContinuousToken, err error)
	// HeadSnapshot reads the latest version of the snapshot from the repository.
	HeadSnapshot(ctx context.Context, tenantID string) (token.SnapToken, error)
}

RelationshipReader -

type RelationshipWriter

type RelationshipWriter interface {
	// WriteRelationships writes relation tuples to the repository.
	WriteRelationships(ctx context.Context, tenantID string, collection *database.TupleCollection) (token token.EncodedSnapToken, err error)
	// DeleteRelationships deletes relation tuples from the repository.
	DeleteRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter) (token token.EncodedSnapToken, err error)
}

RelationshipWriter -

type SchemaDefinition

type SchemaDefinition struct {
	TenantID             string
	EntityType           string
	SerializedDefinition []byte
	Version              string
}

SchemaDefinition - Structure for Schema Definition

func (SchemaDefinition) Serialized

func (e SchemaDefinition) Serialized() string

Serialized - get schema serialized definition

type SchemaReader

type SchemaReader interface {
	// ReadSchema reads entity config from the repository.
	ReadSchema(ctx context.Context, tenantID string, version string) (schema *base.SchemaDefinition, err error)
	// ReadSchemaDefinition reads entity config from the repository.
	ReadSchemaDefinition(ctx context.Context, tenantID string, entityType, version string) (definition *base.EntityDefinition, v string, err error)
	// HeadVersion reads the latest version of the schema from the repository.
	HeadVersion(ctx context.Context, tenantID string) (version string, err error)
}

SchemaReader -

type SchemaWriter

type SchemaWriter interface {
	// WriteSchema writes schema to the repository.
	WriteSchema(ctx context.Context, definitions []SchemaDefinition) (err error)
}

SchemaWriter -

type Tenant

type Tenant struct {
	ID        string
	Name      string
	CreatedAt time.Time
}

Tenant - Structure for tenant

func (Tenant) ToTenant

func (r Tenant) ToTenant() *base.Tenant

ToTenant - Convert database tenant to base tenant

type TenantReader

type TenantReader interface {
	// ListTenants reads tenants from the repository.
	ListTenants(ctx context.Context, pagination database.Pagination) (tenants []*base.Tenant, ct database.EncodedContinuousToken, err error)
}

TenantReader -

type TenantWriter

type TenantWriter interface {
	// CreateTenant writes tenant to the repository.
	CreateTenant(ctx context.Context, id, name string) (tenant *base.Tenant, err error)
	// DeleteTenant deletes tenant from the repository.
	DeleteTenant(ctx context.Context, tenantID string) (tenant *base.Tenant, err error)
}

TenantWriter -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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