postgres

package
v0.0.0-...-839bc5d Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RelationTuplesTable   = "relation_tuples"
	SchemaDefinitionTable = "schema_definitions"
	TransactionsTable     = "transactions"
	TenantsTable          = "tenants"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RelationshipReader

type RelationshipReader struct {
	// contains filtered or unexported fields
}

func NewRelationshipReader

func NewRelationshipReader(database *db.Postgres, logger logger.Interface) *RelationshipReader

NewRelationshipReader - Creates a new RelationshipReader

func (*RelationshipReader) GetUniqueEntityIDsByEntityType

func (r *RelationshipReader) GetUniqueEntityIDsByEntityType(ctx context.Context, tenantID string, typ, snap string) (ids []string, err error)

GetUniqueEntityIDsByEntityType - Gets all unique entity ids for a given entity type

func (*RelationshipReader) HeadSnapshot

func (r *RelationshipReader) HeadSnapshot(ctx context.Context, tenantID string) (token.SnapToken, error)

HeadSnapshot - Gets the latest token

func (*RelationshipReader) QueryRelationships

func (r *RelationshipReader) QueryRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter, snap string) (it *database.TupleIterator, err error)

QueryRelationships - Query relationships for a given filter

func (*RelationshipReader) ReadRelationships

func (r *RelationshipReader) ReadRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter, snap string, pagination database.Pagination) (collection *database.TupleCollection, ct database.EncodedContinuousToken, err error)

ReadRelationships - Read relationships for a given filter and pagination

type RelationshipWriter

type RelationshipWriter struct {
	// contains filtered or unexported fields
}

RelationshipWriter - Structure for Relationship Writer

func NewRelationshipWriter

func NewRelationshipWriter(database *db.Postgres, logger logger.Interface) *RelationshipWriter

NewRelationshipWriter - Creates a new RelationTupleReader

func (*RelationshipWriter) DeleteRelationships

func (w *RelationshipWriter) DeleteRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter) (token token.EncodedSnapToken, err error)

DeleteRelationships - Deletes a collection of relationships to the database

func (*RelationshipWriter) WriteRelationships

func (w *RelationshipWriter) WriteRelationships(ctx context.Context, tenantID string, collection *database.TupleCollection) (token token.EncodedSnapToken, err error)

WriteRelationships - Writes a collection of relationships to the database

type SchemaReader

type SchemaReader struct {
	// contains filtered or unexported fields
}

SchemaReader - Structure for SchemaReader

func NewSchemaReader

func NewSchemaReader(database *db.Postgres, logger logger.Interface) *SchemaReader

NewSchemaReader - Creates a new SchemaReader

func (*SchemaReader) HeadVersion

func (r *SchemaReader) HeadVersion(ctx context.Context, tenantID string) (version string, err error)

HeadVersion - Finds the latest version of the schema.

func (*SchemaReader) ReadSchema

func (r *SchemaReader) ReadSchema(ctx context.Context, tenantID, version string) (sch *base.SchemaDefinition, err error)

ReadSchema - Reads entity config from the repository.

func (*SchemaReader) ReadSchemaDefinition

func (r *SchemaReader) ReadSchemaDefinition(ctx context.Context, tenantID, entityType, version string) (definition *base.EntityDefinition, v string, err error)

ReadSchemaDefinition - Reads entity config from the repository.

type SchemaWriter

type SchemaWriter struct {
	// contains filtered or unexported fields
}

SchemaWriter - Structure for SchemaWriter

func NewSchemaWriter

func NewSchemaWriter(database *db.Postgres, logger logger.Interface) *SchemaWriter

NewSchemaWriter creates a new SchemaWriter

func (*SchemaWriter) WriteSchema

func (w *SchemaWriter) WriteSchema(ctx context.Context, schemas []repositories.SchemaDefinition) (err error)

WriteSchema writes a schema to the database

type TenantReader

type TenantReader struct {
	// contains filtered or unexported fields
}

func NewTenantReader

func NewTenantReader(database *db.Postgres, logger logger.Interface) *TenantReader

NewTenantReader - Creates a new TenantReader

func (*TenantReader) ListTenants

func (r *TenantReader) ListTenants(ctx context.Context, pagination database.Pagination) (tenants []*base.Tenant, ct database.EncodedContinuousToken, err error)

ListTenants - Lists all Tenants

type TenantWriter

type TenantWriter struct {
	// contains filtered or unexported fields
}

TenantWriter - Structure for Tenant Writer

func NewTenantWriter

func NewTenantWriter(database *db.Postgres, logger logger.Interface) *TenantWriter

NewTenantWriter - Creates a new TenantWriter

func (*TenantWriter) CreateTenant

func (w *TenantWriter) CreateTenant(ctx context.Context, id, name string) (result *base.Tenant, err error)

CreateTenant - Creates a new Tenant

func (*TenantWriter) DeleteTenant

func (w *TenantWriter) DeleteTenant(ctx context.Context, tenantID string) (result *base.Tenant, err error)

DeleteTenant - Deletes a Tenant

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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