Documentation ¶
Index ¶
- Constants
- func BytesToBool(value []byte) *bool
- func BytesToDatetime(buf []byte, name string) *time.Time
- func BytesToFloat64(buf []byte) *float64
- func BytesToInt32(buf []byte) *int32
- func BytesToInt64(buf []byte) *int64
- func BytesToString(buf []byte) *string
- func DecodeNext(val []byte) ([]byte, []byte, error)
- func DecodeStringSlice(compoundKey []byte) ([]string, error)
- func DumpBoltDb(tx *bbolt.Tx)
- func EncodeByteSlice(value []byte) ([]byte, error)
- func EncodeStringSlice(values []string) ([]byte, error)
- func FieldToBool(fieldType FieldType, value []byte) *bool
- func FieldToDatetime(fieldType FieldType, value []byte, name string) *time.Time
- func FieldToFloat64(fieldType FieldType, value []byte) *float64
- func FieldToInt32(fieldType FieldType, value []byte) *int32
- func FieldToInt64(fieldType FieldType, value []byte) *int64
- func FieldToString(fieldType FieldType, value []byte) *string
- func GetSingularEntityType(entityType string) string
- func Int32ToBytes(value int32) []byte
- func IsErrNotFoundErr(err error) bool
- func IsReferenceExistsError(err error) bool
- func IsUniqueIndexDuplicateError(err error) bool
- func NewBoltCursor(cursor *bbolt.Cursor, forward bool) ast.SeekableSetCursor
- func NewForwardBoltCursor(cursor *bbolt.Cursor) ast.SeekableSetCursor
- func NewNotFoundError(entityType, field, id string) error
- func NewReferenceByIdError(localType, localId, remoteType, remoteId, remoteField string) error
- func NewReferenceByIdsError(localType, localId, remoteType string, remoteIds []string, remoteField string) error
- func NewReverseBoltCursor(cursor *bbolt.Cursor) ast.SeekableSetCursor
- func NewTypedForwardBoltCursor(cursor *bbolt.Cursor, fieldType FieldType) ast.SeekableSetCursor
- func NewTypedReverseBoltCursor(cursor *bbolt.Cursor, fieldType FieldType) ast.SeekableSetCursor
- func PrependFieldType(fieldType FieldType, value []byte) []byte
- func Traverse(tx *bbolt.Tx, visitor BoltVisitor)
- func ValidateDeleted(tx *bbolt.Tx, id string, ignorePaths ...string) error
- func ValidateSymbolsArePublic(query ast.Query, store ListStore) error
- type BaseBoltCursor
- type BaseExtEntity
- func (entity *BaseExtEntity) CreateBaseValues(ctx *PersistContext)
- func (entity *BaseExtEntity) GetCreatedAt() time.Time
- func (entity *BaseExtEntity) GetId() string
- func (entity *BaseExtEntity) GetTags() map[string]interface{}
- func (entity *BaseExtEntity) GetUpdatedAt() time.Time
- func (entity *BaseExtEntity) IsSystemEntity() bool
- func (entity *BaseExtEntity) LoadBaseValues(bucket *TypedBucket)
- func (entity *BaseExtEntity) SetBaseValues(ctx *PersistContext)
- func (entity *BaseExtEntity) SetCreatedAt(createdAt time.Time)
- func (entity *BaseExtEntity) SetId(id string)
- func (entity *BaseExtEntity) SetTags(tags map[string]interface{})
- func (entity *BaseExtEntity) SetUpdatedAt(updatedAt time.Time)
- func (entity *BaseExtEntity) UpdateBaseValues(ctx *PersistContext)
- type BaseStore
- func (store *BaseStore) AddDeleteHandler(handler EntityChangeHandler)
- func (store *BaseStore) AddEvent(ctx MutateContext, entity Entity, name events.EventName)
- func (store *BaseStore) AddExtEntitySymbols()
- func (store *BaseStore) AddFkSetSymbol(name string, listStore ListStore) EntitySetSymbol
- func (store *BaseStore) AddFkSymbol(name string, linkedStore ListStore, prefix ...string) EntitySymbol
- func (store *BaseStore) AddFkSymbolWithKey(name string, key string, linkedStore ListStore, prefix ...string) EntitySymbol
- func (store *BaseStore) AddIdSymbol(name string, nodeType ast.NodeType) EntitySymbol
- func (store *BaseStore) AddLinkCollection(local EntitySymbol, remote EntitySymbol) LinkCollection
- func (store *BaseStore) AddMapSymbol(name string, nodeType ast.NodeType, key string, prefix ...string)
- func (store *BaseStore) AddPublicSetSymbol(name string, nodeType ast.NodeType) EntitySetSymbol
- func (store *BaseStore) AddRefCountedLinkCollection(local EntitySymbol, remote EntitySymbol) RefCountedLinkCollection
- func (store *BaseStore) AddSetSymbol(name string, nodeType ast.NodeType) EntitySetSymbol
- func (store *BaseStore) AddSymbol(name string, nodeType ast.NodeType, prefix ...string) EntitySymbol
- func (store *BaseStore) AddSymbolWithKey(name string, nodeType ast.NodeType, key string, prefix ...string) EntitySymbol
- func (store *BaseStore) AddUpdateHandler(handler EntityChangeHandler)
- func (store *BaseStore) BaseLoadOneById(tx *bbolt.Tx, id string, entity Entity) (bool, error)
- func (store *BaseStore) BaseLoadOneByQuery(tx *bbolt.Tx, query string, entity Entity) (bool, error)
- func (store *BaseStore) BaseLoadOneChildById(tx *bbolt.Tx, id string, childId string, entity Entity) (bool, error)
- func (store *BaseStore) CheckIntegrity(tx *bbolt.Tx, fix bool, errorSink func(err error, fixed bool)) error
- func (store *BaseStore) Create(ctx MutateContext, entity Entity) error
- func (store *BaseStore) CreateChild(ctx MutateContext, id string, entity Entity) error
- func (store *BaseStore) DeleteById(ctx MutateContext, id string) error
- func (store *BaseStore) DeleteChild(ctx MutateContext, id string, entity Entity) error
- func (store *BaseStore) DeleteWhere(ctx MutateContext, query string) error
- func (store *BaseStore) Extended() *BaseStore
- func (*BaseStore) FindMatching(tx *bbolt.Tx, readIndex SetReadIndex, values []string) []string
- func (*BaseStore) FindMatchingAnyOf(tx *bbolt.Tx, readIndex SetReadIndex, values []string) []string
- func (store *BaseStore) GetEntitiesBucket(tx *bbolt.Tx) *TypedBucket
- func (store *BaseStore) GetEntityBucket(tx *bbolt.Tx, id []byte) *TypedBucket
- func (store *BaseStore) GetEntityType() string
- func (store *BaseStore) GetLinkCollection(name string) LinkCollection
- func (store *BaseStore) GetOrCreateEntitiesBucket(tx *bbolt.Tx) *TypedBucket
- func (store *BaseStore) GetOrCreateEntityBucket(tx *bbolt.Tx, id []byte) *TypedBucket
- func (store *BaseStore) GetParentStore() CrudStore
- func (store *BaseStore) GetPublicSymbols() []string
- func (store *BaseStore) GetRefCountedLinkCollection(name string) RefCountedLinkCollection
- func (store *BaseStore) GetRelatedEntitiesCursor(tx *bbolt.Tx, id string, field string, forward bool) ast.SetCursor
- func (store *BaseStore) GetRelatedEntitiesIdList(tx *bbolt.Tx, id string, field string) []string
- func (store *BaseStore) GetRootPath() []string
- func (store *BaseStore) GetSetSymbolTypes(name string) ast.SymbolTypes
- func (store *BaseStore) GetSingularEntityType() string
- func (store *BaseStore) GetSymbol(name string) EntitySymbol
- func (store *BaseStore) GetSymbolType(name string) (ast.NodeType, bool)
- func (store *BaseStore) GetValue(tx *bbolt.Tx, id []byte, path ...string) []byte
- func (store *BaseStore) GetValueCursor(tx *bbolt.Tx, id []byte, path ...string) *bbolt.Cursor
- func (store *BaseStore) GrantSymbols(child ListStore)
- func (store *BaseStore) InitImpl(impl CrudStore)
- func (store *BaseStore) IsChildStore() bool
- func (store *BaseStore) IsEntityPresent(tx *bbolt.Tx, id string) bool
- func (store *BaseStore) IsEntityRelated(tx *bbolt.Tx, id string, field string, relatedEntityId string) bool
- func (store *BaseStore) IsExtended() bool
- func (store *BaseStore) IsSet(name string) (bool, bool)
- func (store *BaseStore) IterateIds(tx *bbolt.Tx, filter ast.BoolNode) ast.SeekableSetCursor
- func (store *BaseStore) IterateValidIds(tx *bbolt.Tx, filter ast.BoolNode) ast.SeekableSetCursor
- func (*BaseStore) IteratorMatchingAllOf(readIndex SetReadIndex, values []string) ast.SetCursorProvider
- func (*BaseStore) IteratorMatchingAnyOf(readIndex SetReadIndex, values []string) ast.SetCursorProvider
- func (store *BaseStore) ListChildIds(tx *bbolt.Tx, id string, childType string) []string
- func (store *BaseStore) MakeSymbolPublic(symbol string)
- func (store *BaseStore) MapSymbol(name string, mapper SymbolMapper)
- func (store *BaseStore) NewEntitySymbol(name string, nodeType ast.NodeType) EntitySymbol
- func (store *BaseStore) NewIndexingContext(isCreate bool, ctx MutateContext, id string, holder errorz.ErrorHolder) *IndexingContext
- func (store *BaseStore) NewRowComparator(sort []ast.SortField) (RowComparator, error)
- func (store *BaseStore) NewScanner(sort []ast.SortField) Scanner
- func (store *BaseStore) QueryIds(tx *bbolt.Tx, queryString string) ([]string, int64, error)
- func (store *BaseStore) QueryIdsC(tx *bbolt.Tx, query ast.Query) ([]string, int64, error)
- func (store *BaseStore) QueryIdsf(tx *bbolt.Tx, queryString string, args ...interface{}) ([]string, int64, error)
- func (store *BaseStore) QueryWithCursorC(tx *bbolt.Tx, cursorProvider ast.SetCursorProvider, query ast.Query) ([]string, int64, error)
- func (store *BaseStore) Update(ctx MutateContext, entity Entity, checker FieldChecker) error
- func (store *BaseStore) UpdateChild(ctx MutateContext, id string, entity Entity, checker FieldChecker) error
- type BaseTestContext
- func (ctx *BaseTestContext) Cleanup()
- func (ctx *BaseTestContext) Create(entity Entity) error
- func (ctx *BaseTestContext) CreateTags() map[string]interface{}
- func (ctx *BaseTestContext) Delete(entity Entity) error
- func (ctx *BaseTestContext) GetDb() Db
- func (ctx *BaseTestContext) GetDbFile() *os.File
- func (ctx *BaseTestContext) GetRelatedIds(entity Entity, field string) []string
- func (ctx *BaseTestContext) GetStoreForEntity(entity Entity) CrudStore
- func (ctx *BaseTestContext) InitDbFile()
- func (ctx *BaseTestContext) NextTest(t *testing.T)
- func (ctx *BaseTestContext) Patch(entity Entity, checker FieldChecker) error
- func (ctx *BaseTestContext) Reload(entity Entity) error
- func (ctx *BaseTestContext) RequireCreate(entity Entity)
- func (ctx *BaseTestContext) RequireDelete(entity Entity)
- func (ctx *BaseTestContext) RequirePatch(entity Entity, checker FieldChecker)
- func (ctx *BaseTestContext) RequireReload(entity Entity)
- func (ctx *BaseTestContext) RequireUpdate(entity Entity)
- func (ctx *BaseTestContext) Update(entity Entity) error
- func (ctx *BaseTestContext) ValidateBaseline(entity ExtEntity, opts ...cmp.Option)
- func (ctx *BaseTestContext) ValidateDeleted(id string, ignorePaths ...string)
- func (ctx *BaseTestContext) ValidateUpdated(entity ExtEntity)
- type BoltVisitor
- type CascadeType
- type CommitAction
- type Constrained
- type Constraint
- type CrudStore
- type Db
- type DbImpl
- func (self *DbImpl) AddRestoreListener(f func())
- func (self *DbImpl) Batch(fn func(tx *bbolt.Tx) error) error
- func (self *DbImpl) Close() error
- func (self *DbImpl) GetSnapshotId() (*string, error)
- func (self *DbImpl) Open(path string) error
- func (self *DbImpl) RestoreSnapshot(snapshot []byte)
- func (self *DbImpl) RootBucket(tx *bbolt.Tx) (*bbolt.Bucket, error)
- func (self *DbImpl) Snapshot(tx *bbolt.Tx) error
- func (self *DbImpl) SnapshotToMemory() (string, []byte, error)
- func (self *DbImpl) Stats() bbolt.Stats
- func (self *DbImpl) Update(fn func(tx *bbolt.Tx) error) error
- func (self *DbImpl) View(fn func(tx *bbolt.Tx) error) error
- type Entity
- type EntityChangeHandler
- type EntityChangeHandlers
- type EntitySetSymbol
- type EntitySymbol
- type ExtEntity
- type FieldChecker
- type FieldType
- type FieldTypeAndValue
- type ForwardBoltCursor
- type Indexer
- func (indexer *Indexer) AddConstraint(constraint Constraint)
- func (indexer *Indexer) AddFkConstraint(symbol EntitySymbol, nullable bool, cascade CascadeType)
- func (indexer *Indexer) AddFkIndex(symbol EntitySymbol, fkSymbol EntitySetSymbol)
- func (indexer *Indexer) AddNullableFkIndex(symbol EntitySymbol, fkSymbol EntitySetSymbol)
- func (indexer *Indexer) AddNullableUniqueIndex(symbol EntitySymbol) ReadIndex
- func (indexer *Indexer) AddSetIndex(symbol EntitySetSymbol) SetReadIndex
- func (indexer *Indexer) AddUniqueIndex(symbol EntitySymbol) ReadIndex
- func (indexer *Indexer) InitializeIndexes(tx *bbolt.Tx, errorHolder errorz.ErrorHolder)
- type IndexingContext
- func (ctx *IndexingContext) PopState(constraint Constraint) *FieldTypeAndValue
- func (ctx *IndexingContext) PopStateBool(constraint Constraint) bool
- func (ctx *IndexingContext) PopStateString(constraint Constraint) string
- func (ctx *IndexingContext) ProcessAfterUpdate()
- func (ctx *IndexingContext) ProcessBeforeDelete()
- func (ctx *IndexingContext) ProcessBeforeUpdate()
- func (ctx *IndexingContext) PushState(constraint Constraint, fieldType FieldType, fieldValue []byte)
- func (ctx *IndexingContext) Tx() *bbolt.Tx
- type LinkCollection
- type LinkedSetSymbol
- 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 (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 MapContext
- type MapFieldChecker
- type MappedFieldChecker
- type MigrationManager
- type MigrationStep
- type Migrator
- type MutateContext
- type NamedExtEntity
- type NotNilStringMapper
- type PersistContext
- func (ctx *PersistContext) GetAndSetString(field string, value string) (*string, bool)
- func (ctx *PersistContext) GetAndSetStringList(field string, value []string) ([]string, bool)
- func (ctx *PersistContext) GetParentContext() *PersistContext
- func (ctx *PersistContext) ProceedWithSet(field string) bool
- func (ctx *PersistContext) SetBool(field string, value bool)
- func (ctx *PersistContext) SetInt32(field string, value int32)
- func (ctx *PersistContext) SetInt64(field string, value int64)
- func (ctx *PersistContext) SetLinkedIds(field string, value []string)
- func (ctx *PersistContext) SetMap(field string, value map[string]interface{})
- func (ctx *PersistContext) SetRequiredString(field string, value string)
- func (ctx *PersistContext) SetString(field string, value string)
- func (ctx *PersistContext) SetStringList(field string, value []string)
- func (ctx *PersistContext) SetStringP(field string, value *string)
- func (ctx *PersistContext) SetTimeP(field string, value *time.Time)
- func (ctx *PersistContext) WithFieldOverrides(overrides map[string]string)
- type ReadIndex
- type RecordNotFoundError
- type RefCountedLinkCollection
- type RefCountedLinkedSetSymbol
- type ReferenceExistsError
- type ReverseBoltCursor
- type Row
- type RowComparator
- type RowContext
- type RowCursor
- type RuntimeEntitySetSymbol
- type Scanner
- type SetChangeListener
- type SetReadIndex
- type SymbolMapper
- type TestContext
- type TestEvent
- type TestEventChecker
- type TypedBucket
- func (bucket *TypedBucket) CheckAndDeleteListEntry(fieldType FieldType, value []byte) (bool, error)
- func (bucket *TypedBucket) CheckAndSetListEntry(fieldType FieldType, value []byte) (bool, error)
- func (bucket *TypedBucket) Copy(other *TypedBucket, filterF func(path []string) bool) error
- func (bucket *TypedBucket) DecrementLinkCount(fieldType FieldType, value []byte) (int, error)
- func (bucket *TypedBucket) DeleteEntity(id string)
- func (bucket *TypedBucket) DeleteListEntry(fieldType FieldType, value []byte) *TypedBucket
- func (bucket *TypedBucket) DeleteValue(key []byte) *TypedBucket
- func (bucket *TypedBucket) EmptyBucket(name string) (*TypedBucket, error)
- func (bucket *TypedBucket) GetAndSetString(name string, value string, fieldChecker FieldChecker) (*string, bool)
- func (bucket *TypedBucket) GetAndSetStringList(name string, value []string, fieldChecker FieldChecker) ([]string, bool)
- func (bucket *TypedBucket) GetBool(name string) *bool
- func (bucket *TypedBucket) GetBoolWithDefault(name string, defaultValue bool) bool
- func (bucket *TypedBucket) GetBucket(name string) *TypedBucket
- func (bucket *TypedBucket) GetBucketByKey(key []byte) *TypedBucket
- func (bucket *TypedBucket) GetFloat64(name string) *float64
- func (bucket *TypedBucket) GetInt32(name string) *int32
- func (bucket *TypedBucket) GetInt32WithDefault(name string, defaultValue int32) int32
- func (bucket *TypedBucket) GetInt64(name string) *int64
- func (bucket *TypedBucket) GetInt64WithDefault(name string, defaultValue int64) int64
- func (bucket *TypedBucket) GetLinkCount(fieldType FieldType, value []byte) *int32
- func (bucket *TypedBucket) GetList(name string) []interface{}
- func (bucket *TypedBucket) GetMap(name string) map[string]interface{}
- func (bucket *TypedBucket) GetOrCreateBucket(name string) *TypedBucket
- func (bucket *TypedBucket) GetOrCreatePath(path ...string) *TypedBucket
- func (bucket *TypedBucket) GetParent() *TypedBucket
- func (bucket *TypedBucket) GetPath(path ...string) *TypedBucket
- func (bucket *TypedBucket) GetString(name string) *string
- func (bucket *TypedBucket) GetStringList(name string) []string
- func (bucket *TypedBucket) GetStringOrError(name string) string
- func (bucket *TypedBucket) GetStringWithDefault(name string, defaultValue string) string
- func (bucket *TypedBucket) GetTime(name string) *time.Time
- func (bucket *TypedBucket) GetTimeOrError(name string) time.Time
- func (bucket *TypedBucket) IncrementLinkCount(fieldType FieldType, value []byte) (int, error)
- func (bucket *TypedBucket) IsKeyPresent(key []byte) bool
- func (bucket *TypedBucket) IsStringListEmpty(name string) bool
- func (bucket *TypedBucket) IterateStringList() ast.SeekableSetCursor
- func (bucket *TypedBucket) OpenCursor(_ *bbolt.Tx, forward bool) ast.SetCursor
- func (bucket *TypedBucket) OpenSeekableCursor() ast.SeekableSetCursor
- func (bucket *TypedBucket) OpenTypedCursor(_ *bbolt.Tx, forward bool) ast.SetCursor
- func (bucket *TypedBucket) ProceedWithSet(name string, checker FieldChecker) bool
- func (bucket *TypedBucket) PutList(name string, value []interface{}, checker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) PutMap(name string, value map[string]interface{}, checker FieldChecker, ...) *TypedBucket
- func (bucket *TypedBucket) PutValue(key []byte, value []byte) *TypedBucket
- func (bucket *TypedBucket) ReadStringList() []string
- func (bucket *TypedBucket) SetBool(name string, value bool, checker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) SetFloat64(name string, value float64, fieldChecker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) SetInt32(name string, value int32, fieldChecker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) SetInt64(name string, value int64, fieldChecker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) SetLinkCount(fieldType FieldType, value []byte, count int) (*int32, error)
- func (bucket *TypedBucket) SetListEntry(fieldType FieldType, value []byte) *TypedBucket
- func (bucket *TypedBucket) SetNil(name string)
- func (bucket *TypedBucket) SetString(name string, value string, fieldChecker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) SetStringList(name string, value []string, fieldChecker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) SetStringP(name string, value *string, fieldChecker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) SetTime(name string, value time.Time, fieldChecker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) SetTimeP(name string, value *time.Time, fieldChecker FieldChecker) *TypedBucket
- func (bucket *TypedBucket) Tx() *bbolt.Tx
- type TypedForwardBoltCursor
- type TypedReverseBoltCursor
- type UniqueIndexDuplicateError
- type ValidIdsCursors
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 BytesToFloat64 ¶
func BytesToInt32 ¶
func BytesToInt64 ¶
func BytesToString ¶
func DecodeStringSlice ¶
func DumpBoltDb ¶
func EncodeByteSlice ¶
func EncodeStringSlice ¶
func FieldToBool ¶
func FieldToDatetime ¶
func FieldToFloat64 ¶
func FieldToInt32 ¶
func FieldToInt64 ¶
func FieldToString ¶
func GetSingularEntityType ¶
func Int32ToBytes ¶
func IsErrNotFoundErr ¶
func IsReferenceExistsError ¶
func NewBoltCursor ¶
func NewBoltCursor(cursor *bbolt.Cursor, forward bool) ast.SeekableSetCursor
func NewForwardBoltCursor ¶
func NewForwardBoltCursor(cursor *bbolt.Cursor) ast.SeekableSetCursor
func NewNotFoundError ¶
func NewReferenceByIdError ¶
func NewReferenceByIdsError ¶
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 Traverse ¶
func Traverse(tx *bbolt.Tx, visitor BoltVisitor)
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 NewChildBaseStore ¶
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 (*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 (*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) AddSymbolWithKey ¶
func (*BaseStore) AddUpdateHandler ¶
func (store *BaseStore) AddUpdateHandler(handler EntityChangeHandler)
func (*BaseStore) BaseLoadOneById ¶
func (*BaseStore) BaseLoadOneByQuery ¶
func (*BaseStore) BaseLoadOneChildById ¶
func (*BaseStore) CheckIntegrity ¶
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) FindMatching ¶
func (*BaseStore) FindMatchingAnyOf ¶
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 (*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 (*BaseStore) GetPublicSymbols ¶
func (*BaseStore) GetRefCountedLinkCollection ¶
func (store *BaseStore) GetRefCountedLinkCollection(name string) RefCountedLinkCollection
func (*BaseStore) GetRelatedEntitiesCursor ¶
func (*BaseStore) GetRelatedEntitiesIdList ¶
func (*BaseStore) GetRootPath ¶ added in v0.1.17
func (*BaseStore) GetSetSymbolTypes ¶
func (store *BaseStore) GetSetSymbolTypes(name string) ast.SymbolTypes
func (*BaseStore) GetSingularEntityType ¶
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 (*BaseStore) GetValueCursor ¶
func (*BaseStore) GrantSymbols ¶
func (*BaseStore) IsChildStore ¶
func (*BaseStore) IsEntityPresent ¶
func (*BaseStore) IsEntityRelated ¶
func (*BaseStore) IsExtended ¶
func (*BaseStore) IterateIds ¶
func (*BaseStore) IterateValidIds ¶
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 (*BaseStore) MakeSymbolPublic ¶
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) QueryWithCursorC ¶
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 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) // 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 (*DbImpl) AddRestoreListener ¶ added in v0.1.17
func (self *DbImpl) AddRestoreListener(f func())
func (*DbImpl) GetSnapshotId ¶ added in v0.1.17
func (*DbImpl) RestoreSnapshot ¶ added in v0.1.17
func (*DbImpl) RootBucket ¶ added in v0.1.17
func (*DbImpl) SnapshotToMemory ¶ added in v0.1.17
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 ¶
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 FieldChecker ¶
func NewMappedFieldChecker ¶
func NewMappedFieldChecker(checker FieldChecker, mappings map[string]string) FieldChecker
type FieldTypeAndValue ¶
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 (*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 (*LinkedSetSymbol) AddCompoundLink ¶
func (*LinkedSetSymbol) RemoveCompoundLink ¶
func (*LinkedSetSymbol) RemoveLink ¶
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 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 {
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 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 RecordNotFoundError ¶
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 RowComparator ¶
type RowContext ¶
type RowContext struct {
// contains filtered or unexported fields
}
type RuntimeEntitySetSymbol ¶
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 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 (*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) 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 (*TypedBucket) OpenSeekableCursor ¶
func (bucket *TypedBucket) OpenSeekableCursor() ast.SeekableSetCursor
func (*TypedBucket) OpenTypedCursor ¶
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 (*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 ¶
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)
Source Files ¶
- base.go
- db.go
- encode.go
- errors.go
- indexes.go
- link_collection.go
- link_collection_rc.go
- listeners.go
- migration.go
- paths.go
- query.go
- query_bolt_cursors.go
- query_cursor.go
- query_scanners.go
- query_sort.go
- query_symbols.go
- store.go
- store_crud.go
- store_query.go
- system_entity_constraint.go
- test_events.go
- testing.go
- tx_context.go
- typed_bucket.go
- validate.go
Click to show internal directories.
Click to hide internal directories.