database

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeBundle added in v0.6.0

type AttributeBundle struct {
	// Write is an AttributeCollection intended to hold attributes that are to be created or updated.
	Write AttributeCollection

	// Delete is an AttributeCollection intended to hold attributes that are to be deleted.
	Delete AttributeCollection
}

AttributeBundle defines a structure for managing collections of attributes, with separate collections for write (create/update) and delete operations.

type AttributeCollection added in v0.5.0

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

AttributeCollection -Attribute collection.

func NewAttributeCollection added in v0.5.0

func NewAttributeCollection(attributes ...*base.Attribute) *AttributeCollection

NewAttributeCollection - Create new attribute collection.

func (*AttributeCollection) Add added in v0.5.0

func (t *AttributeCollection) Add(attribute *base.Attribute)

Add - New subject to collection.

func (*AttributeCollection) CreateAttributeIterator added in v0.5.0

func (t *AttributeCollection) CreateAttributeIterator() *AttributeIterator

CreateAttributeIterator - Create tuple iterator according to collection.

func (*AttributeCollection) GetAttributes added in v0.5.0

func (t *AttributeCollection) GetAttributes() []*base.Attribute

GetAttributes - Get entities

type AttributeIterator added in v0.5.0

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

AttributeIterator - Attribute iterator -

func NewAttributeIterator added in v0.5.0

func NewAttributeIterator(attributes ...*base.Attribute) *AttributeIterator

NewAttributeIterator -

func (*AttributeIterator) GetNext added in v0.5.0

func (u *AttributeIterator) GetNext() *base.Attribute

GetNext - Get next entity

func (*AttributeIterator) HasNext added in v0.5.0

func (u *AttributeIterator) HasNext() bool

HasNext - Checks whether next entity exists

type ContinuousToken added in v0.3.0

type ContinuousToken interface {
	// Encode encodes the continuous token to a string.
	Encode() EncodedContinuousToken
}

ContinuousToken -

func NewNoopContinuousToken added in v0.4.4

func NewNoopContinuousToken() ContinuousToken

NewNoopContinuousToken - Creates a new continuous token

type CursorPagination added in v1.0.2

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

CursorPagination -

func NewCursorPagination added in v1.0.2

func NewCursorPagination(opts ...CursorPaginationOption) CursorPagination

NewCursorPagination -

func (CursorPagination) Cursor added in v1.0.2

func (p CursorPagination) Cursor() string

Cursor -

func (CursorPagination) Sort added in v1.0.2

func (p CursorPagination) Sort() string

Sort -

type CursorPaginationOption added in v1.0.2

type CursorPaginationOption func(*CursorPagination)

CursorPaginationOption - Option type

func Cursor added in v1.0.2

func Cursor(cursor string) CursorPaginationOption

Cursor -

func Sort added in v1.0.2

func Sort(sort string) CursorPaginationOption

Sort -

type Database

type Database interface {
	// GetEngineType get the database type (e.g. postgres, memory, etc.).
	GetEngineType() string

	// Close the database connection.
	Close() error

	// IsReady - Check if database is ready
	IsReady(ctx context.Context) (bool, error)
}

Database - Db interface

type EncodedContinuousToken added in v0.3.0

type EncodedContinuousToken interface {
	// String returns the string representation of the continuous token.
	String() string
	// Decode decodes the continuous token from a string
	Decode() (ContinuousToken, error)
}

EncodedContinuousToken -

type Engine

type Engine string

Engine - Type declaration of engine

const (
	POSTGRES Engine = "postgres"
	MEMORY   Engine = "memory"
)

func (Engine) String

func (c Engine) String() string

String - Convert to string

type EntityCollection

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

EntityCollection - Entity collection.

func NewEntityCollection

func NewEntityCollection(entities ...*base.Entity) *EntityCollection

NewEntityCollection - Create new subject collection.

func (*EntityCollection) Add

func (e *EntityCollection) Add(entity *base.Entity)

Add - New subject to collection.

func (*EntityCollection) CreateEntityIterator

func (e *EntityCollection) CreateEntityIterator() *EntityIterator

CreateEntityIterator - Create entity iterator according to collection.

func (*EntityCollection) GetEntities

func (e *EntityCollection) GetEntities() []*base.Entity

GetEntities - Get entities

type EntityIterator

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

EntityIterator - Structure for entity iterator

func NewEntityIterator added in v0.3.0

func NewEntityIterator(entities []*base.Entity) *EntityIterator

NewEntityIterator -

func (*EntityIterator) GetNext

func (u *EntityIterator) GetNext() *base.Entity

GetNext - Get next entity

func (*EntityIterator) HasNext

func (u *EntityIterator) HasNext() bool

HasNext - Checks whether next entity exists

type NoopContinuousToken added in v0.4.4

type NoopContinuousToken struct {
	Value string
}

func (NoopContinuousToken) Encode added in v0.4.4

Encode - Encodes the token to a string

type NoopEncodedContinuousToken added in v0.4.4

type NoopEncodedContinuousToken struct {
	Value string
}

func (NoopEncodedContinuousToken) Decode added in v0.4.4

Decode decodes the token from a string

func (NoopEncodedContinuousToken) String added in v0.4.4

Decode decodes the token from a string

type Pagination added in v0.3.0

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

Pagination -

func NewPagination added in v0.3.0

func NewPagination(opts ...PaginationOption) Pagination

NewPagination -

func (Pagination) PageSize added in v0.3.0

func (p Pagination) PageSize() uint32

PageSize -

func (Pagination) Token added in v0.3.0

func (p Pagination) Token() string

Token -

type PaginationOption added in v1.0.2

type PaginationOption func(*Pagination)

PaginationOption - Option type

func Size added in v0.3.0

func Size(size uint32) PaginationOption

Size -

func Token added in v0.3.0

func Token(token string) PaginationOption

Token -

type SubjectCollection

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

SubjectCollection - Subject collection.

func NewSubjectCollection

func NewSubjectCollection(subjects ...*base.Subject) *SubjectCollection

NewSubjectCollection - Create new subject collection.

func (*SubjectCollection) Add

func (s *SubjectCollection) Add(subject *base.Subject)

Add - New subject to collection.

func (*SubjectCollection) CreateSubjectIterator

func (s *SubjectCollection) CreateSubjectIterator() *SubjectIterator

CreateSubjectIterator - Create subject iterator according to collection.

func (*SubjectCollection) GetSubjects

func (s *SubjectCollection) GetSubjects() []*base.Subject

GetSubjects - Get subject collection

type SubjectIterator

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

SubjectIterator - Structure for subject iterator

func NewSubjectIterator added in v0.3.0

func NewSubjectIterator(subjects []*base.Subject) *SubjectIterator

NewSubjectIterator -

func (*SubjectIterator) GetNext

func (u *SubjectIterator) GetNext() *base.Subject

GetNext - Get next tuple

func (*SubjectIterator) HasNext

func (u *SubjectIterator) HasNext() bool

HasNext - Checks whether next subject exists

type TupleBundle added in v0.6.0

type TupleBundle struct {
	// Write is a TupleCollection intended to hold tuples that are to be created or updated.
	Write TupleCollection

	// Delete is a TupleCollection intended to hold tuples that are to be deleted.
	Delete TupleCollection
}

TupleBundle defines a structure for managing collections of tuples, with separate collections for write (create/update) and delete operations.

type TupleCollection

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

TupleCollection -Tuple collection.

func NewTupleCollection

func NewTupleCollection(tuples ...*base.Tuple) *TupleCollection

NewTupleCollection - Create new tuple collection.

func (*TupleCollection) Add

func (t *TupleCollection) Add(tuple *base.Tuple)

Add - New subject to collection.

func (*TupleCollection) CreateTupleIterator

func (t *TupleCollection) CreateTupleIterator() *TupleIterator

CreateTupleIterator - Create tuple iterator according to collection.

func (*TupleCollection) GetTuples

func (t *TupleCollection) GetTuples() []*base.Tuple

GetTuples - Get tuples

func (*TupleCollection) ToSubjectCollection

func (t *TupleCollection) ToSubjectCollection() *SubjectCollection

ToSubjectCollection - Converts new subject collection from given tuple collection

type TupleIterator

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

TupleIterator - Tuple iterator -

func NewTupleIterator added in v0.3.0

func NewTupleIterator(tuples ...*base.Tuple) *TupleIterator

NewTupleIterator -

func (*TupleIterator) GetNext

func (i *TupleIterator) GetNext() *base.Tuple

GetNext - Get next tuple

func (*TupleIterator) HasNext

func (i *TupleIterator) HasNext() bool

HasNext - Checks whether next tuple exists

type UniqueAttributeIterator added in v0.5.0

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

UniqueAttributeIterator combines two AttributeIterators and ensures that only unique Attributes are returned. Uniqueness is based on the Attribute's pointer address.

func NewUniqueAttributeIterator added in v0.5.0

func NewUniqueAttributeIterator(iterator1, iterator2 *AttributeIterator) *UniqueAttributeIterator

NewUniqueAttributeIterator creates a new UniqueAttributeIterator from two AttributeIterators.

func (*UniqueAttributeIterator) GetNext added in v0.5.0

func (i *UniqueAttributeIterator) GetNext() (*base.Attribute, bool)

GetNext returns the next unique Tuple from the two TupleIterators.

func (*UniqueAttributeIterator) HasNext added in v0.5.0

func (i *UniqueAttributeIterator) HasNext() bool

HasNext checks if there is a next Tuple in either of the two TupleIterators.

type UniqueTupleIterator added in v0.4.5

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

UniqueTupleIterator combines two TupleIterators and ensures that only unique Tuples are returned. Uniqueness is based on the Tuple's pointer address.

func NewUniqueTupleIterator added in v0.4.5

func NewUniqueTupleIterator(iterator1, iterator2 *TupleIterator) *UniqueTupleIterator

NewUniqueTupleIterator creates a new UniqueTupleIterator from two TupleIterators.

func (*UniqueTupleIterator) GetNext added in v0.4.5

func (i *UniqueTupleIterator) GetNext() (*base.Tuple, bool)

GetNext returns the next unique Tuple from the two TupleIterators.

func (*UniqueTupleIterator) HasNext added in v0.4.5

func (i *UniqueTupleIterator) HasNext() bool

HasNext checks if there is a next Tuple in either of the two TupleIterators.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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