boltz

package
v0.1.32 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: Apache-2.0 Imports: 28 Imported by: 48

Documentation

Index

Constants

View Source
const (
	EventCreate events.EventName = "CREATE"
	EventDelete events.EventName = "DELETE"
	EventUpdate events.EventName = "UPDATE"

	FieldId             = "id"
	FieldCreatedAt      = "createdAt"
	FieldUpdatedAt      = "updatedAt"
	FieldTags           = "tags"
	FieldIsSystemEntity = "isSystem"
)
View Source
const (
	Metadata   = "meta"
	SnapshotId = "snapshotId"
)
View Source
const (
	CascadeNone         = 1
	CascadeDelete       = 2
	CascadeCreateUpdate = 3
)
View Source
const (
	TestEntityTypeChild  = "child"
	TestEntityTypeParent = "parent"
)
View Source
const (
	IndexesBucket = "indexes"
)
View Source
const (
	ListSizeKeyName = "__list__size__36484231-110c-4767-afe2-01b6e3db107a"
)
View Source
const MaxLinkedSetKeySize = 4096
View Source
const (
	SortMax = 5
)

Variables

This section is empty.

Functions

func BytesToBool

func BytesToBool(value []byte) *bool

func BytesToDatetime

func BytesToDatetime(buf []byte, name string) *time.Time

func BytesToFloat64

func BytesToFloat64(buf []byte) *float64

func BytesToInt32

func BytesToInt32(buf []byte) *int32

func BytesToInt64

func BytesToInt64(buf []byte) *int64

func BytesToString

func BytesToString(buf []byte) *string

func DecodeNext

func DecodeNext(val []byte) ([]byte, []byte, error)

func DecodeStringSlice

func DecodeStringSlice(compoundKey []byte) ([]string, error)

func DumpBoltDb

func DumpBoltDb(tx *bbolt.Tx)

func EncodeByteSlice

func EncodeByteSlice(value []byte) ([]byte, error)

func EncodeStringSlice

func EncodeStringSlice(values []string) ([]byte, error)

func FieldToBool

func FieldToBool(fieldType FieldType, value []byte) *bool

func FieldToDatetime

func FieldToDatetime(fieldType FieldType, value []byte, name string) *time.Time

func FieldToFloat64

func FieldToFloat64(fieldType FieldType, value []byte) *float64

func FieldToInt32

func FieldToInt32(fieldType FieldType, value []byte) *int32

func FieldToInt64

func FieldToInt64(fieldType FieldType, value []byte) *int64

func FieldToString

func FieldToString(fieldType FieldType, value []byte) *string

func GetSingularEntityType

func GetSingularEntityType(entityType string) string

func Int32ToBytes

func Int32ToBytes(value int32) []byte

func IsErrNotFoundErr

func IsErrNotFoundErr(err error) bool

func IsReferenceExistsError

func IsReferenceExistsError(err error) bool

func IsUniqueIndexDuplicateError

func IsUniqueIndexDuplicateError(err error) bool

func NewBoltCursor

func NewBoltCursor(cursor *bbolt.Cursor, forward bool) ast.SeekableSetCursor

func NewForwardBoltCursor

func NewForwardBoltCursor(cursor *bbolt.Cursor) ast.SeekableSetCursor

func NewNotFoundError

func NewNotFoundError(entityType, field, id string) error

func NewReferenceByIdError

func NewReferenceByIdError(localType, localId, remoteType, remoteId, remoteField string) error

func NewReferenceByIdsError

func NewReferenceByIdsError(localType, localId, remoteType string, remoteIds []string, remoteField string) error

func NewReverseBoltCursor

func NewReverseBoltCursor(cursor *bbolt.Cursor) ast.SeekableSetCursor

func NewTypedForwardBoltCursor

func NewTypedForwardBoltCursor(cursor *bbolt.Cursor, fieldType FieldType) ast.SeekableSetCursor

func NewTypedReverseBoltCursor

func NewTypedReverseBoltCursor(cursor *bbolt.Cursor, fieldType FieldType) ast.SeekableSetCursor

func PrependFieldType

func PrependFieldType(fieldType FieldType, value []byte) []byte

func Traverse

func Traverse(tx *bbolt.Tx, visitor BoltVisitor)

func ValidateDeleted

func ValidateDeleted(tx *bbolt.Tx, id string, ignorePaths ...string) error

func ValidateSymbolsArePublic

func ValidateSymbolsArePublic(query ast.Query, store ListStore) error

Types

type BaseBoltCursor

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

func (*BaseBoltCursor) Current

func (f *BaseBoltCursor) Current() []byte

func (*BaseBoltCursor) IsValid

func (f *BaseBoltCursor) IsValid() bool

type BaseExtEntity

type BaseExtEntity struct {
	Id        string
	CreatedAt time.Time
	UpdatedAt time.Time
	Tags      map[string]interface{}
	IsSystem  bool
	Migrate   bool
}

func NewExtEntity

func NewExtEntity(id string, tags map[string]interface{}) *BaseExtEntity

func (*BaseExtEntity) CreateBaseValues

func (entity *BaseExtEntity) CreateBaseValues(ctx *PersistContext)

func (*BaseExtEntity) GetCreatedAt

func (entity *BaseExtEntity) GetCreatedAt() time.Time

func (*BaseExtEntity) GetId

func (entity *BaseExtEntity) GetId() string

func (*BaseExtEntity) GetTags

func (entity *BaseExtEntity) GetTags() map[string]interface{}

func (*BaseExtEntity) GetUpdatedAt

func (entity *BaseExtEntity) GetUpdatedAt() time.Time

func (*BaseExtEntity) IsSystemEntity

func (entity *BaseExtEntity) IsSystemEntity() bool

func (*BaseExtEntity) LoadBaseValues

func (entity *BaseExtEntity) LoadBaseValues(bucket *TypedBucket)

func (*BaseExtEntity) SetBaseValues

func (entity *BaseExtEntity) SetBaseValues(ctx *PersistContext)

func (*BaseExtEntity) SetCreatedAt

func (entity *BaseExtEntity) SetCreatedAt(createdAt time.Time)

func (*BaseExtEntity) SetId

func (entity *BaseExtEntity) SetId(id string)

func (*BaseExtEntity) SetTags

func (entity *BaseExtEntity) SetTags(tags map[string]interface{})

func (*BaseExtEntity) SetUpdatedAt

func (entity *BaseExtEntity) SetUpdatedAt(updatedAt time.Time)

func (*BaseExtEntity) UpdateBaseValues

func (entity *BaseExtEntity) UpdateBaseValues(ctx *PersistContext)

type BaseStore

type BaseStore struct {
	Indexer

	events.EventEmmiter
	// contains filtered or unexported fields
}

func NewBaseStore

func NewBaseStore(entityType string, entityNotFoundF func(id string) error, basePath ...string) *BaseStore

func NewChildBaseStore

func NewChildBaseStore(parent CrudStore, parentMapper func(Entity) Entity, entityNotFoundF func(id string) error, basePath ...string) *BaseStore

func (*BaseStore) AddDeleteHandler

func (store *BaseStore) AddDeleteHandler(handler EntityChangeHandler)

func (*BaseStore) AddEvent

func (store *BaseStore) AddEvent(ctx MutateContext, entity Entity, name events.EventName)

func (*BaseStore) AddExtEntitySymbols

func (store *BaseStore) AddExtEntitySymbols()

func (*BaseStore) AddFkSetSymbol

func (store *BaseStore) AddFkSetSymbol(name string, listStore ListStore) EntitySetSymbol

func (*BaseStore) AddFkSymbol

func (store *BaseStore) AddFkSymbol(name string, linkedStore ListStore, prefix ...string) EntitySymbol

func (*BaseStore) AddFkSymbolWithKey

func (store *BaseStore) AddFkSymbolWithKey(name string, key string, linkedStore ListStore, prefix ...string) EntitySymbol

func (*BaseStore) AddIdSymbol

func (store *BaseStore) AddIdSymbol(name string, nodeType ast.NodeType) EntitySymbol

func (*BaseStore) AddLinkCollection

func (store *BaseStore) AddLinkCollection(local EntitySymbol, remote EntitySymbol) LinkCollection

func (*BaseStore) AddMapSymbol

func (store *BaseStore) AddMapSymbol(name string, nodeType ast.NodeType, key string, prefix ...string)

func (*BaseStore) AddPublicSetSymbol

func (store *BaseStore) AddPublicSetSymbol(name string, nodeType ast.NodeType) EntitySetSymbol

func (*BaseStore) AddRefCountedLinkCollection

func (store *BaseStore) AddRefCountedLinkCollection(local EntitySymbol, remote EntitySymbol) RefCountedLinkCollection

func (*BaseStore) AddSetSymbol

func (store *BaseStore) AddSetSymbol(name string, nodeType ast.NodeType) EntitySetSymbol

func (*BaseStore) AddSymbol

func (store *BaseStore) AddSymbol(name string, nodeType ast.NodeType, prefix ...string) EntitySymbol

func (*BaseStore) AddSymbolWithKey

func (store *BaseStore) AddSymbolWithKey(name string, nodeType ast.NodeType, key string, prefix ...string) EntitySymbol

func (*BaseStore) AddUpdateHandler

func (store *BaseStore) AddUpdateHandler(handler EntityChangeHandler)

func (*BaseStore) BaseLoadOneById

func (store *BaseStore) BaseLoadOneById(tx *bbolt.Tx, id string, entity Entity) (bool, error)

func (*BaseStore) BaseLoadOneByQuery

func (store *BaseStore) BaseLoadOneByQuery(tx *bbolt.Tx, query string, entity Entity) (bool, error)

func (*BaseStore) BaseLoadOneChildById

func (store *BaseStore) BaseLoadOneChildById(tx *bbolt.Tx, id string, childId string, entity Entity) (bool, error)

func (*BaseStore) CheckIntegrity

func (store *BaseStore) CheckIntegrity(tx *bbolt.Tx, fix bool, errorSink func(err error, fixed bool)) error

func (*BaseStore) Create

func (store *BaseStore) Create(ctx MutateContext, entity Entity) error

func (*BaseStore) CreateChild

func (store *BaseStore) CreateChild(ctx MutateContext, id string, entity Entity) error

func (*BaseStore) DeleteById

func (store *BaseStore) DeleteById(ctx MutateContext, id string) error

func (*BaseStore) DeleteChild

func (store *BaseStore) DeleteChild(ctx MutateContext, id string, entity Entity) error

func (*BaseStore) DeleteWhere

func (store *BaseStore) DeleteWhere(ctx MutateContext, query string) error

func (*BaseStore) Extended

func (store *BaseStore) Extended() *BaseStore

func (*BaseStore) FindMatching

func (*BaseStore) FindMatching(tx *bbolt.Tx, readIndex SetReadIndex, values []string) []string

func (*BaseStore) FindMatchingAnyOf

func (*BaseStore) FindMatchingAnyOf(tx *bbolt.Tx, readIndex SetReadIndex, values []string) []string

func (*BaseStore) GetEntitiesBucket

func (store *BaseStore) GetEntitiesBucket(tx *bbolt.Tx) *TypedBucket

func (*BaseStore) GetEntityBucket

func (store *BaseStore) GetEntityBucket(tx *bbolt.Tx, id []byte) *TypedBucket

func (*BaseStore) GetEntityType

func (store *BaseStore) GetEntityType() string

func (*BaseStore) GetLinkCollection

func (store *BaseStore) GetLinkCollection(name string) LinkCollection

func (*BaseStore) GetOrCreateEntitiesBucket

func (store *BaseStore) GetOrCreateEntitiesBucket(tx *bbolt.Tx) *TypedBucket

func (*BaseStore) GetOrCreateEntityBucket

func (store *BaseStore) GetOrCreateEntityBucket(tx *bbolt.Tx, id []byte) *TypedBucket

func (*BaseStore) GetParentStore

func (store *BaseStore) GetParentStore() CrudStore

func (*BaseStore) GetPublicSymbols

func (store *BaseStore) GetPublicSymbols() []string

func (*BaseStore) GetRefCountedLinkCollection

func (store *BaseStore) GetRefCountedLinkCollection(name string) RefCountedLinkCollection

func (*BaseStore) GetRelatedEntitiesCursor

func (store *BaseStore) GetRelatedEntitiesCursor(tx *bbolt.Tx, id string, field string, forward bool) ast.SetCursor

func (*BaseStore) GetRelatedEntitiesIdList

func (store *BaseStore) GetRelatedEntitiesIdList(tx *bbolt.Tx, id string, field string) []string

func (*BaseStore) GetRootPath added in v0.1.17

func (store *BaseStore) GetRootPath() []string

func (*BaseStore) GetSetSymbolTypes

func (store *BaseStore) GetSetSymbolTypes(name string) ast.SymbolTypes

func (*BaseStore) GetSingularEntityType

func (store *BaseStore) GetSingularEntityType() string

func (*BaseStore) GetSymbol

func (store *BaseStore) GetSymbol(name string) EntitySymbol

GetSymbol returns the symbol for the given name, or nil if the symbol doesn't exist

func (*BaseStore) GetSymbolType

func (store *BaseStore) GetSymbolType(name string) (ast.NodeType, bool)

func (*BaseStore) GetValue

func (store *BaseStore) GetValue(tx *bbolt.Tx, id []byte, path ...string) []byte

func (*BaseStore) GetValueCursor

func (store *BaseStore) GetValueCursor(tx *bbolt.Tx, id []byte, path ...string) *bbolt.Cursor

func (*BaseStore) GrantSymbols

func (store *BaseStore) GrantSymbols(child ListStore)

func (*BaseStore) InitImpl

func (store *BaseStore) InitImpl(impl CrudStore)

func (*BaseStore) IsChildStore

func (store *BaseStore) IsChildStore() bool

func (*BaseStore) IsEntityPresent

func (store *BaseStore) IsEntityPresent(tx *bbolt.Tx, id string) bool

func (*BaseStore) IsEntityRelated

func (store *BaseStore) IsEntityRelated(tx *bbolt.Tx, id string, field string, relatedEntityId string) bool

func (*BaseStore) IsExtended

func (store *BaseStore) IsExtended() bool

func (*BaseStore) IsPublicSymbol added in v0.1.21

func (store *BaseStore) IsPublicSymbol(symbol string) bool

func (*BaseStore) IsSet

func (store *BaseStore) IsSet(name string) (bool, bool)

func (*BaseStore) IterateIds

func (store *BaseStore) IterateIds(tx *bbolt.Tx, filter ast.BoolNode) ast.SeekableSetCursor

func (*BaseStore) IterateValidIds

func (store *BaseStore) IterateValidIds(tx *bbolt.Tx, filter ast.BoolNode) ast.SeekableSetCursor

func (*BaseStore) IteratorMatchingAllOf

func (*BaseStore) IteratorMatchingAllOf(readIndex SetReadIndex, values []string) ast.SetCursorProvider

func (*BaseStore) IteratorMatchingAnyOf

func (*BaseStore) IteratorMatchingAnyOf(readIndex SetReadIndex, values []string) ast.SetCursorProvider

func (*BaseStore) ListChildIds

func (store *BaseStore) ListChildIds(tx *bbolt.Tx, id string, childType string) []string

func (*BaseStore) MakeSymbolPublic

func (store *BaseStore) MakeSymbolPublic(symbol string)

func (*BaseStore) MapSymbol

func (store *BaseStore) MapSymbol(name string, mapper SymbolMapper)

func (*BaseStore) NewEntitySymbol

func (store *BaseStore) NewEntitySymbol(name string, nodeType ast.NodeType) EntitySymbol

func (*BaseStore) NewIndexingContext

func (store *BaseStore) NewIndexingContext(isCreate bool, ctx MutateContext, id string, holder errorz.ErrorHolder) *IndexingContext

func (*BaseStore) NewRowComparator

func (store *BaseStore) NewRowComparator(sort []ast.SortField) (RowComparator, error)

func (*BaseStore) NewScanner

func (store *BaseStore) NewScanner(sort []ast.SortField) Scanner

func (*BaseStore) QueryIds

func (store *BaseStore) QueryIds(tx *bbolt.Tx, queryString string) ([]string, int64, error)

func (*BaseStore) QueryIdsC

func (store *BaseStore) QueryIdsC(tx *bbolt.Tx, query ast.Query) ([]string, int64, error)

func (*BaseStore) QueryIdsf

func (store *BaseStore) QueryIdsf(tx *bbolt.Tx, queryString string, args ...interface{}) ([]string, int64, error)

func (*BaseStore) QueryWithCursorC

func (store *BaseStore) QueryWithCursorC(tx *bbolt.Tx, cursorProvider ast.SetCursorProvider, query ast.Query) ([]string, int64, error)

func (*BaseStore) Update

func (store *BaseStore) Update(ctx MutateContext, entity Entity, checker FieldChecker) error

func (*BaseStore) UpdateChild

func (store *BaseStore) UpdateChild(ctx MutateContext, id string, entity Entity, checker FieldChecker) error

type BaseTestContext

type BaseTestContext struct {
	require.Assertions

	ReferenceTime time.Time
	Impl          TestContext
	// contains filtered or unexported fields
}

func NewTestContext

func NewTestContext(t testing.TB) *BaseTestContext

func (*BaseTestContext) Cleanup

func (ctx *BaseTestContext) Cleanup()

func (*BaseTestContext) Create

func (ctx *BaseTestContext) Create(entity Entity) error

func (*BaseTestContext) CreateTags

func (ctx *BaseTestContext) CreateTags() map[string]interface{}

func (*BaseTestContext) Delete

func (ctx *BaseTestContext) Delete(entity Entity) error

func (*BaseTestContext) GetDb

func (ctx *BaseTestContext) GetDb() Db

func (*BaseTestContext) GetDbFile

func (ctx *BaseTestContext) GetDbFile() *os.File

func (*BaseTestContext) GetRelatedIds

func (ctx *BaseTestContext) GetRelatedIds(entity Entity, field string) []string

func (*BaseTestContext) GetStoreForEntity

func (ctx *BaseTestContext) GetStoreForEntity(entity Entity) CrudStore

func (*BaseTestContext) InitDbFile

func (ctx *BaseTestContext) InitDbFile()

func (*BaseTestContext) NextTest

func (ctx *BaseTestContext) NextTest(t *testing.T)

func (*BaseTestContext) Patch

func (ctx *BaseTestContext) Patch(entity Entity, checker FieldChecker) error

func (*BaseTestContext) Reload

func (ctx *BaseTestContext) Reload(entity Entity) error

func (*BaseTestContext) RequireCreate

func (ctx *BaseTestContext) RequireCreate(entity Entity)

func (*BaseTestContext) RequireDelete

func (ctx *BaseTestContext) RequireDelete(entity Entity)

func (*BaseTestContext) RequirePatch

func (ctx *BaseTestContext) RequirePatch(entity Entity, checker FieldChecker)

func (*BaseTestContext) RequireReload

func (ctx *BaseTestContext) RequireReload(entity Entity)

func (*BaseTestContext) RequireUpdate

func (ctx *BaseTestContext) RequireUpdate(entity Entity)

func (*BaseTestContext) Update

func (ctx *BaseTestContext) Update(entity Entity) error

func (*BaseTestContext) ValidateBaseline

func (ctx *BaseTestContext) ValidateBaseline(entity ExtEntity, opts ...cmp.Option)

func (*BaseTestContext) ValidateDeleted

func (ctx *BaseTestContext) ValidateDeleted(id string, ignorePaths ...string)

func (*BaseTestContext) ValidateUpdated

func (ctx *BaseTestContext) ValidateUpdated(entity ExtEntity)

type BoltVisitor

type BoltVisitor interface {
	VisitBucket(path string, key []byte, bucket *bbolt.Bucket) bool
	VisitKeyValue(path string, key, value []byte) bool
}

type CascadeType

type CascadeType int

type CommitAction

type CommitAction interface {
	Exec()
}

type Constrained

type Constrained interface {
	AddConstraint(constraint Constraint)
}

type Constraint

type Constraint interface {
	ProcessBeforeUpdate(ctx *IndexingContext)
	ProcessAfterUpdate(ctx *IndexingContext)
	ProcessBeforeDelete(ctx *IndexingContext)
	Initialize(tx *bbolt.Tx, errorHolder errorz.ErrorHolder)
	CheckIntegrity(tx *bbolt.Tx, fix bool, errorSink func(err error, fixed bool)) error
}

func NewSystemEntityEnforcementConstraint

func NewSystemEntityEnforcementConstraint(store ListStore) Constraint

type CrudStore

type CrudStore interface {
	ListStore
	Constrained

	GetParentStore() CrudStore
	AddLinkCollection(local EntitySymbol, remove EntitySymbol) LinkCollection
	AddRefCountedLinkCollection(local EntitySymbol, remove EntitySymbol) RefCountedLinkCollection
	GetLinkCollection(name string) LinkCollection
	GetRefCountedLinkCollection(name string) RefCountedLinkCollection

	Create(ctx MutateContext, entity Entity) error
	Update(ctx MutateContext, entity Entity, checker FieldChecker) error
	DeleteById(ctx MutateContext, id string) error
	DeleteWhere(ctx MutateContext, query string) error

	CreateChild(ctx MutateContext, parentId string, entity Entity) error
	UpdateChild(ctx MutateContext, parentId string, entity Entity, checker FieldChecker) error
	DeleteChild(ctx MutateContext, parentId string, entity Entity) error
	ListChildIds(tx *bbolt.Tx, parentId string, childType string) []string

	BaseLoadOneById(tx *bbolt.Tx, id string, entity Entity) (bool, error)
	BaseLoadOneByQuery(tx *bbolt.Tx, query string, entity Entity) (bool, error)
	BaseLoadOneChildById(tx *bbolt.Tx, id string, childId string, entity Entity) (bool, error)
	NewStoreEntity() Entity

	AddDeleteHandler(handler EntityChangeHandler)
	AddUpdateHandler(handler EntityChangeHandler)
	NewIndexingContext(isCreate bool, ctx MutateContext, id string, holder errorz.ErrorHolder) *IndexingContext

	CheckIntegrity(tx *bbolt.Tx, fix bool, errorSink func(err error, fixed bool)) error

	AddEvent(ctx MutateContext, entity Entity, name events.EventName)
	events.EventEmmiter
	// contains filtered or unexported methods
}

type Db

type Db interface {
	io.Closer
	Update(fn func(tx *bbolt.Tx) error) error
	Batch(fn func(tx *bbolt.Tx) error) error
	View(fn func(tx *bbolt.Tx) error) error
	RootBucket(tx *bbolt.Tx) (*bbolt.Bucket, error)

	// Snapshot makes a copy of the bolt file
	Snapshot(tx *bbolt.Tx) error

	// SnapshotToMemory writes a snapshot of the database state to a memory buffer.
	// The snapshot has a UUID generated and stored at rootBucket/snapshotId
	// The snapshot id and snapshot are returned
	SnapshotToMemory() (string, []byte, error)

	// SnapshotToWriter writes a snapshot of the database state to the given writer
	// The snapshot has a UUID generated and stored at rootBucket/snapshotId
	// The snapshot id and snapshot are returned
	SnapshotToWriter(w io.Writer) (string, error)

	// GetSnapshotId returns the id of the last snapshot created/restored
	GetSnapshotId() (*string, error)

	// RestoreSnapshot will replace the existing DB with the given snapshot
	// This operation is not allowed to fail, and will thus panic if the snapshot cannot be restored
	RestoreSnapshot(snapshotData []byte)

	// AddRestoreListener adds a callback which will be invoked asynchronously when a snapshot is restored
	AddRestoreListener(listener func())
}

type DbImpl added in v0.1.17

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

func Open added in v0.1.17

func Open(path string, rootBucket string) (*DbImpl, error)

func (*DbImpl) AddRestoreListener added in v0.1.17

func (self *DbImpl) AddRestoreListener(f func())

func (*DbImpl) Batch added in v0.1.17

func (self *DbImpl) Batch(fn func(tx *bbolt.Tx) error) error

func (*DbImpl) Close added in v0.1.17

func (self *DbImpl) Close() error

func (*DbImpl) GetSnapshotId added in v0.1.17

func (self *DbImpl) GetSnapshotId() (*string, error)

func (*DbImpl) Open added in v0.1.17

func (self *DbImpl) Open(path string) error

func (*DbImpl) RestoreSnapshot added in v0.1.17

func (self *DbImpl) RestoreSnapshot(snapshot []byte)

func (*DbImpl) RootBucket added in v0.1.17

func (self *DbImpl) RootBucket(tx *bbolt.Tx) (*bbolt.Bucket, error)

func (*DbImpl) Snapshot added in v0.1.17

func (self *DbImpl) Snapshot(tx *bbolt.Tx) error

func (*DbImpl) SnapshotToMemory added in v0.1.17

func (self *DbImpl) SnapshotToMemory() (string, []byte, error)

func (*DbImpl) SnapshotToWriter added in v0.1.32

func (self *DbImpl) SnapshotToWriter(w io.Writer) (string, error)

func (*DbImpl) Stats added in v0.1.17

func (self *DbImpl) Stats() bbolt.Stats

func (*DbImpl) Update added in v0.1.17

func (self *DbImpl) Update(fn func(tx *bbolt.Tx) error) error

func (*DbImpl) View added in v0.1.17

func (self *DbImpl) View(fn func(tx *bbolt.Tx) error) error

type Entity

type Entity interface {
	GetId() string
	SetId(id string)
	LoadValues(store CrudStore, bucket *TypedBucket)
	SetValues(ctx *PersistContext)
	GetEntityType() string
}

type EntityChangeHandler

type EntityChangeHandler func(ctx MutateContext, entityId string) error

type EntityChangeHandlers

type EntityChangeHandlers struct {
	atomic.Value
	sync.Mutex
}

func (*EntityChangeHandlers) Add

func (handlers *EntityChangeHandlers) Add(handler EntityChangeHandler)

func (*EntityChangeHandlers) Get

func (handlers *EntityChangeHandlers) Get() []EntityChangeHandler

func (*EntityChangeHandlers) Handle

func (handlers *EntityChangeHandlers) Handle(ctx MutateContext, entityId string) error

type EntitySetSymbol

type EntitySetSymbol interface {
	EntitySymbol
	GetRuntimeSymbol() RuntimeEntitySetSymbol
	EvalStringList(tx *bbolt.Tx, key []byte) []string
	Map(tx *bbolt.Tx, key []byte, f func(ctx *MapContext)) error
}

type EntitySymbol

type EntitySymbol interface {
	GetStore() ListStore
	GetLinkedType() ListStore
	GetPath() []string
	GetType() ast.NodeType
	GetName() string
	IsSet() bool
	Eval(tx *bbolt.Tx, rowId []byte) (FieldType, []byte)
}

type ExtEntity

type ExtEntity interface {
	Entity
	GetCreatedAt() time.Time
	GetUpdatedAt() time.Time
	GetTags() map[string]interface{}
	IsSystemEntity() bool

	SetCreatedAt(createdAt time.Time)
	SetUpdatedAt(updatedAt time.Time)
	SetTags(tags map[string]interface{})
}

type FieldChecker

type FieldChecker interface {
	IsUpdated(string) bool
}

func NewMappedFieldChecker

func NewMappedFieldChecker(checker FieldChecker, mappings map[string]string) FieldChecker

type FieldType

type FieldType byte
const (
	TypeBool    FieldType = 1
	TypeInt32   FieldType = 2
	TypeInt64   FieldType = 3
	TypeFloat64 FieldType = 4
	TypeString  FieldType = 5
	TypeTime    FieldType = 6
	TypeNil     FieldType = 7
)

func GetTypeAndValue

func GetTypeAndValue(bytes []byte) (FieldType, []byte)

type FieldTypeAndValue

type FieldTypeAndValue struct {
	FieldType
	Value []byte
}

type ForwardBoltCursor

type ForwardBoltCursor struct {
	BaseBoltCursor
}

func (*ForwardBoltCursor) Next

func (f *ForwardBoltCursor) Next()

func (*ForwardBoltCursor) Seek

func (f *ForwardBoltCursor) Seek(val []byte)

type Indexer

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

func NewIndexer

func NewIndexer(basePath ...string) *Indexer

func (*Indexer) AddConstraint

func (indexer *Indexer) AddConstraint(constraint Constraint)

func (*Indexer) AddFkConstraint

func (indexer *Indexer) AddFkConstraint(symbol EntitySymbol, nullable bool, cascade CascadeType)

func (*Indexer) AddFkIndex

func (indexer *Indexer) AddFkIndex(symbol EntitySymbol, fkSymbol EntitySetSymbol)

func (*Indexer) AddNullableFkIndex

func (indexer *Indexer) AddNullableFkIndex(symbol EntitySymbol, fkSymbol EntitySetSymbol)

func (*Indexer) AddNullableUniqueIndex

func (indexer *Indexer) AddNullableUniqueIndex(symbol EntitySymbol) ReadIndex

func (*Indexer) AddSetIndex

func (indexer *Indexer) AddSetIndex(symbol EntitySetSymbol) SetReadIndex

func (*Indexer) AddUniqueIndex

func (indexer *Indexer) AddUniqueIndex(symbol EntitySymbol) ReadIndex

func (*Indexer) InitializeIndexes

func (indexer *Indexer) InitializeIndexes(tx *bbolt.Tx, errorHolder errorz.ErrorHolder)

type IndexingContext

type IndexingContext struct {
	Parent *IndexingContext
	*Indexer
	IsCreate   bool
	Ctx        MutateContext
	RowId      []byte
	ErrHolder  errorz.ErrorHolder
	AtomStates map[Constraint][]byte
	SetStates  map[Constraint][]FieldTypeAndValue
}

func (*IndexingContext) PopState

func (ctx *IndexingContext) PopState(constraint Constraint) *FieldTypeAndValue

func (*IndexingContext) PopStateBool

func (ctx *IndexingContext) PopStateBool(constraint Constraint) bool

func (*IndexingContext) PopStateString

func (ctx *IndexingContext) PopStateString(constraint Constraint) string

func (*IndexingContext) ProcessAfterUpdate

func (ctx *IndexingContext) ProcessAfterUpdate()

func (*IndexingContext) ProcessBeforeDelete

func (ctx *IndexingContext) ProcessBeforeDelete()

func (*IndexingContext) ProcessBeforeUpdate

func (ctx *IndexingContext) ProcessBeforeUpdate()

func (*IndexingContext) PushState

func (ctx *IndexingContext) PushState(constraint Constraint, fieldType FieldType, fieldValue []byte)

func (*IndexingContext) Tx

func (ctx *IndexingContext) Tx() *bbolt.Tx

type LinkCollection

type LinkCollection interface {
	AddLinks(tx *bbolt.Tx, id string, keys ...string) error
	AddLink(tx *bbolt.Tx, id []byte, key []byte) (bool, error)
	RemoveLinks(tx *bbolt.Tx, id string, keys ...string) error
	RemoveLink(tx *bbolt.Tx, id []byte, keys []byte) (bool, error)
	SetLinks(tx *bbolt.Tx, id string, keys []string) error
	GetLinks(tx *bbolt.Tx, id string) []string
	IterateLinks(tx *bbolt.Tx, id []byte) ast.SeekableSetCursor
	IsLinked(tx *bbolt.Tx, id, relatedId []byte) bool
	EntityDeleted(tx *bbolt.Tx, id string) error
	GetFieldSymbol() EntitySymbol
	GetLinkedSymbol() EntitySymbol
	CheckIntegrity(tx *bbolt.Tx, fix bool, errorSink func(err error, fixed bool)) error
}

type LinkedSetSymbol

type LinkedSetSymbol struct {
	EntitySymbol
}
func (symbol *LinkedSetSymbol) AddCompoundLink(tx *bbolt.Tx, id string, linkIds []string) error
func (symbol *LinkedSetSymbol) AddLink(tx *bbolt.Tx, id []byte, link []byte) error
func (symbol *LinkedSetSymbol) AddLinkS(tx *bbolt.Tx, id string, link string) error

func (*LinkedSetSymbol) IsLinked

func (symbol *LinkedSetSymbol) IsLinked(tx *bbolt.Tx, id []byte, link []byte) bool
func (symbol *LinkedSetSymbol) RemoveCompoundLink(tx *bbolt.Tx, id string, linkIds []string) error
func (symbol *LinkedSetSymbol) RemoveLink(tx *bbolt.Tx, id []byte, link []byte) error

type ListStore

type ListStore interface {
	ast.SymbolTypes

	GetEntityType() string
	GetSingularEntityType() string
	GetRootPath() []string
	GetEntitiesBucket(tx *bbolt.Tx) *TypedBucket
	GetOrCreateEntitiesBucket(tx *bbolt.Tx) *TypedBucket
	GetEntityBucket(tx *bbolt.Tx, id []byte) *TypedBucket
	GetOrCreateEntityBucket(tx *bbolt.Tx, id []byte) *TypedBucket
	GetValue(tx *bbolt.Tx, id []byte, path ...string) []byte
	GetValueCursor(tx *bbolt.Tx, id []byte, path ...string) *bbolt.Cursor
	IsChildStore() bool
	IsEntityPresent(tx *bbolt.Tx, id string) bool
	IsExtended() bool

	GetSymbol(name string) EntitySymbol
	MapSymbol(name string, wrapper SymbolMapper)
	GrantSymbols(child ListStore)

	AddIdSymbol(name string, nodeType ast.NodeType) EntitySymbol
	AddSymbol(name string, nodeType ast.NodeType, path ...string) EntitySymbol
	AddFkSymbol(name string, linkedType ListStore, path ...string) EntitySymbol
	AddSymbolWithKey(name string, nodeType ast.NodeType, key string, path ...string) EntitySymbol
	AddFkSymbolWithKey(name string, key string, linkedType ListStore, path ...string) EntitySymbol
	AddMapSymbol(name string, nodeType ast.NodeType, key string, path ...string)
	AddSetSymbol(name string, nodeType ast.NodeType) EntitySetSymbol
	AddPublicSetSymbol(name string, nodeType ast.NodeType) EntitySetSymbol
	AddFkSetSymbol(name string, linkedType ListStore) EntitySetSymbol
	NewEntitySymbol(name string, nodeType ast.NodeType) EntitySymbol
	AddExtEntitySymbols()
	MakeSymbolPublic(name string)

	NewRowComparator(sort []ast.SortField) (RowComparator, error)
	GetPublicSymbols() []string
	IsPublicSymbol(symbol string) bool

	FindMatching(tx *bbolt.Tx, readIndex SetReadIndex, values []string) []string

	GetRelatedEntitiesIdList(tx *bbolt.Tx, id string, field string) []string
	GetRelatedEntitiesCursor(tx *bbolt.Tx, id string, field string, forward bool) ast.SetCursor
	IsEntityRelated(tx *bbolt.Tx, id string, field string, relatedEntityId string) bool

	// QueryIds compiles the query and runs it against the store
	QueryIds(tx *bbolt.Tx, query string) ([]string, int64, error)

	// QueryIdsf compiles the query with the given params and runs it against the store
	QueryIdsf(tx *bbolt.Tx, query string, args ...interface{}) ([]string, int64, error)

	// QueryIdsC executes a compile query against the store
	QueryIdsC(tx *bbolt.Tx, query ast.Query) ([]string, int64, error)

	QueryWithCursorC(tx *bbolt.Tx, cursorProvider ast.SetCursorProvider, query ast.Query) ([]string, int64, error)

	IterateIds(tx *bbolt.Tx, filter ast.BoolNode) ast.SeekableSetCursor

	// IterateValidIds skips non-present entities in extended stores
	IterateValidIds(tx *bbolt.Tx, filter ast.BoolNode) ast.SeekableSetCursor
	// contains filtered or unexported methods
}

type MapContext

type MapContext struct {
	errorz.ErrorHolderImpl
	// contains filtered or unexported fields
}

func (*MapContext) Delete

func (ctx *MapContext) Delete()

func (*MapContext) Replace

func (ctx *MapContext) Replace(fieldType FieldType, val []byte)

func (*MapContext) ReplaceS

func (ctx *MapContext) ReplaceS(val string)

func (*MapContext) Stop

func (ctx *MapContext) Stop()

func (*MapContext) Type

func (ctx *MapContext) Type() FieldType

func (*MapContext) Value

func (ctx *MapContext) Value() []byte

func (*MapContext) ValueS

func (ctx *MapContext) ValueS() string

type MapFieldChecker

type MapFieldChecker map[string]struct{}

func (MapFieldChecker) IsUpdated

func (m MapFieldChecker) IsUpdated(name string) bool

func (MapFieldChecker) ToSlice

func (m MapFieldChecker) ToSlice() []string

type MappedFieldChecker

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

func (*MappedFieldChecker) IsUpdated

func (f *MappedFieldChecker) IsUpdated(field string) bool

type MigrationManager

type MigrationManager interface {
	GetComponentVersion(component string) (int, error)
	Migrate(component string, targetVersion int, migrator Migrator) error
}

func NewMigratorManager

func NewMigratorManager(db Db) MigrationManager

type MigrationStep

type MigrationStep struct {
	errorz.ErrorHolderImpl
	Component      string
	Ctx            MutateContext
	CurrentVersion int
}

type Migrator

type Migrator func(step *MigrationStep) int

type MutateContext

type MutateContext interface {
	Tx() *bbolt.Tx
	AddEvent(em events.EventEmmiter, name events.EventName, entity Entity)
	IsSystemContext() bool
	GetSystemContext() MutateContext
}

func NewMutateContext

func NewMutateContext(tx *bbolt.Tx) MutateContext

func NewSystemMutateContext

func NewSystemMutateContext(ctx MutateContext) MutateContext

type NamedExtEntity

type NamedExtEntity interface {
	ExtEntity
	GetName() string
}

type NotNilStringMapper

type NotNilStringMapper struct {
}

func (NotNilStringMapper) Map

func (n NotNilStringMapper) Map(_ EntitySymbol, fieldType FieldType, value []byte) (FieldType, []byte)

type PersistContext

type PersistContext struct {
	MutateContext
	Id           string
	Store        CrudStore
	Bucket       *TypedBucket
	FieldChecker FieldChecker
	IsCreate     bool
}

func (*PersistContext) GetAndSetString

func (ctx *PersistContext) GetAndSetString(field string, value string) (*string, bool)

func (*PersistContext) GetAndSetStringList

func (ctx *PersistContext) GetAndSetStringList(field string, value []string) ([]string, bool)

func (*PersistContext) GetParentContext

func (ctx *PersistContext) GetParentContext() *PersistContext

func (*PersistContext) ProceedWithSet

func (ctx *PersistContext) ProceedWithSet(field string) bool

func (*PersistContext) SetBool

func (ctx *PersistContext) SetBool(field string, value bool)

func (*PersistContext) SetInt32

func (ctx *PersistContext) SetInt32(field string, value int32)

func (*PersistContext) SetInt64

func (ctx *PersistContext) SetInt64(field string, value int64)

func (*PersistContext) SetLinkedIds

func (ctx *PersistContext) SetLinkedIds(field string, value []string)

func (*PersistContext) SetMap

func (ctx *PersistContext) SetMap(field string, value map[string]interface{})

func (*PersistContext) SetRequiredString

func (ctx *PersistContext) SetRequiredString(field string, value string)

func (*PersistContext) SetString

func (ctx *PersistContext) SetString(field string, value string)

func (*PersistContext) SetStringList

func (ctx *PersistContext) SetStringList(field string, value []string)

func (*PersistContext) SetStringP

func (ctx *PersistContext) SetStringP(field string, value *string)

func (*PersistContext) SetTimeP

func (ctx *PersistContext) SetTimeP(field string, value *time.Time)

func (*PersistContext) WithFieldOverrides

func (ctx *PersistContext) WithFieldOverrides(overrides map[string]string)

type ReadIndex

type ReadIndex interface {
	Read(tx *bbolt.Tx, val []byte) []byte
}

type RecordNotFoundError

type RecordNotFoundError struct {
	EntityType string
	Field      string
	Id         string
}

func (*RecordNotFoundError) Error

func (err *RecordNotFoundError) Error() string

type RefCountedLinkCollection

type RefCountedLinkCollection interface {
	IncrementLinkCount(tx *bbolt.Tx, id []byte, key []byte) (int, error)
	DecrementLinkCount(tx *bbolt.Tx, id []byte, key []byte) (int, error)
	GetLinkCount(tx *bbolt.Tx, id []byte, relatedId []byte) *int32
	GetLinkCounts(tx *bbolt.Tx, id []byte, relatedId []byte) (*int32, *int32)
	SetLinkCount(tx *bbolt.Tx, id []byte, key []byte, count int) (*int32, *int32, error)
	EntityDeleted(tx *bbolt.Tx, id string) error
	IterateLinks(tx *bbolt.Tx, id []byte) ast.SeekableSetCursor
	GetFieldSymbol() EntitySymbol
	GetLinkedSymbol() EntitySymbol
}

type RefCountedLinkedSetSymbol

type RefCountedLinkedSetSymbol struct {
	EntitySymbol
}

type ReferenceExistsError

type ReferenceExistsError struct {
	LocalType   string
	RemoteType  string
	RemoteField string
	LocalId     string
	RemoteIds   []string
}

ReferenceExistsError is an error returned when an operation cannot be completed due to a referential constraint. Typically, when deleting an entity (called local) that is referenced by another entity (called the remote)

func (*ReferenceExistsError) Error

func (err *ReferenceExistsError) Error() string

type ReverseBoltCursor

type ReverseBoltCursor struct {
	BaseBoltCursor
}

func (*ReverseBoltCursor) Next

func (f *ReverseBoltCursor) Next()

func (*ReverseBoltCursor) Seek

func (f *ReverseBoltCursor) Seek(val []byte)

type Row

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

func (*Row) Compare

func (r *Row) Compare(other llrb.Comparable) int

type RowComparator

type RowComparator interface {
	Compare(rowId1, rowId2 RowCursor) int
}

type RowContext

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

type RowCursor

type RowCursor interface {
	CurrentRow() []byte
	Tx() *bbolt.Tx
}

type RuntimeEntitySetSymbol

type RuntimeEntitySetSymbol interface {
	EntitySymbol
	OpenCursor(tx *bbolt.Tx, rowId []byte) ast.SetCursor
}

type Scanner

type Scanner interface {
	Scan(tx *bbolt.Tx, query ast.Query) ([]string, int64, error)
	ScanCursor(tx *bbolt.Tx, cursorProvider ast.SetCursorProvider, query ast.Query) ([]string, int64, error)
}

type SetChangeListener

type SetChangeListener func(ctx MutateContext, rowId []byte, old []FieldTypeAndValue, new []FieldTypeAndValue, holder errorz.ErrorHolder)

type SetReadIndex

type SetReadIndex interface {
	GetSymbol() EntitySetSymbol
	Read(tx *bbolt.Tx, key []byte, f func(val []byte))
	ReadKeys(tx *bbolt.Tx, f func(val []byte))
	OpenValueCursor(tx *bbolt.Tx, key []byte, forward bool) ast.SetCursor
	OpenKeyCursor(tx *bbolt.Tx, forward bool) ast.SetCursor
	AddListener(listener SetChangeListener)
}

type SymbolMapper

type SymbolMapper interface {
	Map(source EntitySymbol, fieldType FieldType, value []byte) (FieldType, []byte)
}

type TestContext

type TestContext interface {
	GetDb() Db
	GetStoreForEntity(entity Entity) CrudStore
	NextTest(t *testing.T)
}

type TestEvent

type TestEvent struct {
	EntityType string
	Entity     Entity
	// contains filtered or unexported fields
}

type TestEventChecker

type TestEventChecker struct {
	*require.Assertions
	// contains filtered or unexported fields
}

func NewTestEventChecker

func NewTestEventChecker(req *require.Assertions) *TestEventChecker

func (*TestEventChecker) AddHandlers

func (self *TestEventChecker) AddHandlers(store CrudStore)

func (*TestEventChecker) RequireEvent

func (self *TestEventChecker) RequireEvent(entityType string, entity Entity, eventType events.EventName) Entity

func (*TestEventChecker) RequireNoEvent

func (self *TestEventChecker) RequireNoEvent()

type TypedBucket

type TypedBucket struct {
	*bbolt.Bucket

	*errorz.ErrorHolderImpl
	// contains filtered or unexported fields
}

func ErrBucket

func ErrBucket(err error) *TypedBucket

func GetOrCreatePath

func GetOrCreatePath(tx *bbolt.Tx, path ...string) *TypedBucket

func Path

func Path(tx *bbolt.Tx, path ...string) *TypedBucket

func (*TypedBucket) CheckAndDeleteListEntry

func (bucket *TypedBucket) CheckAndDeleteListEntry(fieldType FieldType, value []byte) (bool, error)

func (*TypedBucket) CheckAndSetListEntry

func (bucket *TypedBucket) CheckAndSetListEntry(fieldType FieldType, value []byte) (bool, error)

func (*TypedBucket) Copy

func (bucket *TypedBucket) Copy(other *TypedBucket, filterF func(path []string) bool) error

func (*TypedBucket) DecrementLinkCount

func (bucket *TypedBucket) DecrementLinkCount(fieldType FieldType, value []byte) (int, error)

func (*TypedBucket) DeleteEntity

func (bucket *TypedBucket) DeleteEntity(id string)

func (*TypedBucket) DeleteListEntry

func (bucket *TypedBucket) DeleteListEntry(fieldType FieldType, value []byte) *TypedBucket

func (*TypedBucket) DeleteValue

func (bucket *TypedBucket) DeleteValue(key []byte) *TypedBucket

func (*TypedBucket) EmptyBucket

func (bucket *TypedBucket) EmptyBucket(name string) (*TypedBucket, error)

func (*TypedBucket) GetAndSetString

func (bucket *TypedBucket) GetAndSetString(name string, value string, fieldChecker FieldChecker) (*string, bool)

func (*TypedBucket) GetAndSetStringList

func (bucket *TypedBucket) GetAndSetStringList(name string, value []string, fieldChecker FieldChecker) ([]string, bool)

func (*TypedBucket) GetBool

func (bucket *TypedBucket) GetBool(name string) *bool

func (*TypedBucket) GetBoolWithDefault

func (bucket *TypedBucket) GetBoolWithDefault(name string, defaultValue bool) bool

func (*TypedBucket) GetBucket

func (bucket *TypedBucket) GetBucket(name string) *TypedBucket

func (*TypedBucket) GetBucketByKey

func (bucket *TypedBucket) GetBucketByKey(key []byte) *TypedBucket

func (*TypedBucket) GetFloat64

func (bucket *TypedBucket) GetFloat64(name string) *float64

func (*TypedBucket) GetInt32

func (bucket *TypedBucket) GetInt32(name string) *int32

func (*TypedBucket) GetInt32WithDefault

func (bucket *TypedBucket) GetInt32WithDefault(name string, defaultValue int32) int32

func (*TypedBucket) GetInt64

func (bucket *TypedBucket) GetInt64(name string) *int64

func (*TypedBucket) GetInt64WithDefault

func (bucket *TypedBucket) GetInt64WithDefault(name string, defaultValue int64) int64

func (*TypedBucket) GetLinkCount

func (bucket *TypedBucket) GetLinkCount(fieldType FieldType, value []byte) *int32

func (*TypedBucket) GetList

func (bucket *TypedBucket) GetList(name string) []interface{}

func (*TypedBucket) GetMap

func (bucket *TypedBucket) GetMap(name string) map[string]interface{}

func (*TypedBucket) GetOrCreateBucket

func (bucket *TypedBucket) GetOrCreateBucket(name string) *TypedBucket

func (*TypedBucket) GetOrCreatePath

func (bucket *TypedBucket) GetOrCreatePath(path ...string) *TypedBucket

func (*TypedBucket) GetParent

func (bucket *TypedBucket) GetParent() *TypedBucket

func (*TypedBucket) GetPath

func (bucket *TypedBucket) GetPath(path ...string) *TypedBucket

func (*TypedBucket) GetString

func (bucket *TypedBucket) GetString(name string) *string

func (*TypedBucket) GetStringList

func (bucket *TypedBucket) GetStringList(name string) []string

func (*TypedBucket) GetStringOrError

func (bucket *TypedBucket) GetStringOrError(name string) string

func (*TypedBucket) GetStringWithDefault

func (bucket *TypedBucket) GetStringWithDefault(name string, defaultValue string) string

func (*TypedBucket) GetTime

func (bucket *TypedBucket) GetTime(name string) *time.Time

func (*TypedBucket) GetTimeOrError

func (bucket *TypedBucket) GetTimeOrError(name string) time.Time

func (*TypedBucket) IncrementLinkCount

func (bucket *TypedBucket) IncrementLinkCount(fieldType FieldType, value []byte) (int, error)

func (*TypedBucket) IsKeyPresent

func (bucket *TypedBucket) IsKeyPresent(key []byte) bool

func (*TypedBucket) IsStringListEmpty

func (bucket *TypedBucket) IsStringListEmpty(name string) bool

func (*TypedBucket) IterateStringList

func (bucket *TypedBucket) IterateStringList() ast.SeekableSetCursor

func (*TypedBucket) OpenCursor

func (bucket *TypedBucket) OpenCursor(_ *bbolt.Tx, forward bool) ast.SetCursor

func (*TypedBucket) OpenSeekableCursor

func (bucket *TypedBucket) OpenSeekableCursor() ast.SeekableSetCursor

func (*TypedBucket) OpenTypedCursor

func (bucket *TypedBucket) OpenTypedCursor(_ *bbolt.Tx, forward bool) ast.SetCursor

func (*TypedBucket) ProceedWithSet

func (bucket *TypedBucket) ProceedWithSet(name string, checker FieldChecker) bool

func (*TypedBucket) PutList

func (bucket *TypedBucket) PutList(name string, value []interface{}, checker FieldChecker) *TypedBucket

func (*TypedBucket) PutMap

func (bucket *TypedBucket) PutMap(name string, value map[string]interface{}, checker FieldChecker, allowNested bool) *TypedBucket

func (*TypedBucket) PutValue

func (bucket *TypedBucket) PutValue(key []byte, value []byte) *TypedBucket

func (*TypedBucket) ReadStringList

func (bucket *TypedBucket) ReadStringList() []string

func (*TypedBucket) SetBool

func (bucket *TypedBucket) SetBool(name string, value bool, checker FieldChecker) *TypedBucket

func (*TypedBucket) SetFloat64

func (bucket *TypedBucket) SetFloat64(name string, value float64, fieldChecker FieldChecker) *TypedBucket

func (*TypedBucket) SetInt32

func (bucket *TypedBucket) SetInt32(name string, value int32, fieldChecker FieldChecker) *TypedBucket

func (*TypedBucket) SetInt64

func (bucket *TypedBucket) SetInt64(name string, value int64, fieldChecker FieldChecker) *TypedBucket

func (*TypedBucket) SetLinkCount

func (bucket *TypedBucket) SetLinkCount(fieldType FieldType, value []byte, count int) (*int32, error)

func (*TypedBucket) SetListEntry

func (bucket *TypedBucket) SetListEntry(fieldType FieldType, value []byte) *TypedBucket

func (*TypedBucket) SetNil

func (bucket *TypedBucket) SetNil(name string)

func (*TypedBucket) SetString

func (bucket *TypedBucket) SetString(name string, value string, fieldChecker FieldChecker) *TypedBucket

func (*TypedBucket) SetStringList

func (bucket *TypedBucket) SetStringList(name string, value []string, fieldChecker FieldChecker) *TypedBucket

func (*TypedBucket) SetStringP

func (bucket *TypedBucket) SetStringP(name string, value *string, fieldChecker FieldChecker) *TypedBucket

func (*TypedBucket) SetTime

func (bucket *TypedBucket) SetTime(name string, value time.Time, fieldChecker FieldChecker) *TypedBucket

func (*TypedBucket) SetTimeP

func (bucket *TypedBucket) SetTimeP(name string, value *time.Time, fieldChecker FieldChecker) *TypedBucket

func (*TypedBucket) Tx

func (bucket *TypedBucket) Tx() *bbolt.Tx

type TypedForwardBoltCursor

type TypedForwardBoltCursor struct {
	BaseBoltCursor
	// contains filtered or unexported fields
}

func (*TypedForwardBoltCursor) Next

func (f *TypedForwardBoltCursor) Next()

func (*TypedForwardBoltCursor) Seek

func (f *TypedForwardBoltCursor) Seek(val []byte)

type TypedReverseBoltCursor

type TypedReverseBoltCursor struct {
	BaseBoltCursor
	// contains filtered or unexported fields
}

func (*TypedReverseBoltCursor) Next

func (f *TypedReverseBoltCursor) Next()

func (*TypedReverseBoltCursor) Seek

func (f *TypedReverseBoltCursor) Seek(val []byte)

type UniqueIndexDuplicateError

type UniqueIndexDuplicateError struct {
	Field      string
	Value      string
	EntityType string
}

UniqueIndexDuplicateError is an error that is returned when a unique index is violated due to duplicate values

func (*UniqueIndexDuplicateError) Error

func (err *UniqueIndexDuplicateError) Error() string

type ValidIdsCursors

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

func (*ValidIdsCursors) Current

func (cursor *ValidIdsCursors) Current() []byte

func (*ValidIdsCursors) IsExtendedDataPresent

func (cursor *ValidIdsCursors) IsExtendedDataPresent() bool

func (*ValidIdsCursors) IsValid

func (cursor *ValidIdsCursors) IsValid() bool

func (*ValidIdsCursors) Next

func (cursor *ValidIdsCursors) Next()

func (*ValidIdsCursors) Seek

func (cursor *ValidIdsCursors) Seek(bytes []byte)

Jump to

Keyboard shortcuts

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