Documentation ¶
Index ¶
- Constants
- Variables
- 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 FieldToInt64(fieldType FieldType, value []byte) *int64
- func FieldToString(fieldType FieldType, value []byte) *string
- func GetSingularEntityType(entityType string) string
- func IsErrNotFoundErr(err error) bool
- func NewBoltCursor(cursor *bbolt.Cursor, forward bool) ast.SetCursor
- func NewForwardBoltCursor(cursor *bbolt.Cursor) ast.SetCursor
- func NewNotFoundError(entityType, field, id string) error
- func NewReverseBoltCursor(cursor *bbolt.Cursor) ast.SetCursor
- func NewTypedForwardBoltCursor(cursor *bbolt.Cursor) ast.SetCursor
- func NewTypedReverseBoltCursor(cursor *bbolt.Cursor) ast.SetCursor
- func PrependFieldType(fieldType FieldType, value []byte) []byte
- func Traverse(tx *bbolt.Tx, visitor BoltVisitor)
- func ValidateDeleted(tx *bbolt.Tx, id string) error
- func ValidateSymbolsArePublic(query ast.Query, store ListStore) error
- type BaseBoltCursor
- type BaseExtEntity
- type BaseStore
- func (store *BaseStore) AddDeleteHandler(handler EntityChangeHandler)
- 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) 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) 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) CleanupExternal(ctx MutateContext, id string) 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) 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) 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) IsSet(name string) (bool, bool)
- 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) MapSymbol(name string, mapper SymbolMapper)
- func (store *BaseStore) NewEntitySymbol(name string, nodeType ast.NodeType) EntitySymbol
- 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) Reload(entity Entity) error
- func (ctx *BaseTestContext) RequireCreate(entity Entity)
- func (ctx *BaseTestContext) RequireDelete(entity Entity)
- 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)
- func (ctx *BaseTestContext) ValidateDeleted(id string)
- func (ctx *BaseTestContext) ValidateUpdated(entity ExtEntity)
- type BoltVisitor
- type Constraint
- type CrudStore
- type Db
- type Entity
- type EntityChangeHandler
- type EntityChangeHandlers
- type EntitySetSymbol
- type EntitySymbol
- type ExtEntity
- type ExtEntityFields
- func (entity *ExtEntityFields) CreateBaseValues(bucket *TypedBucket)
- func (entity *ExtEntityFields) GetCreatedAt() time.Time
- func (entity *ExtEntityFields) GetTags() map[string]interface{}
- func (entity *ExtEntityFields) GetUpdatedAt() time.Time
- func (entity *ExtEntityFields) LoadBaseValues(bucket *TypedBucket)
- func (entity *ExtEntityFields) SetBaseValues(ctx *PersistContext)
- func (entity *ExtEntityFields) SetCreatedAt(createdAt time.Time)
- func (entity *ExtEntityFields) SetTags(tags map[string]interface{})
- func (entity *ExtEntityFields) SetUpdatedAt(updatedAt time.Time)
- func (entity *ExtEntityFields) UpdateBaseValues(bucket *TypedBucket, fieldChecker FieldChecker)
- type FieldChecker
- type FieldType
- type FieldTypeAndValue
- type ForwardBoltCursor
- type Indexer
- func (indexer *Indexer) AddFkIndex(symbol EntitySymbol, fkSymbol EntitySetSymbol)
- func (indexer *Indexer) AddNullableFkIndex(symbol EntitySymbol, fkSymbol EntitySetSymbol)
- func (indexer *Indexer) AddSetIndex(symbol EntitySetSymbol) SetReadIndex
- func (indexer *Indexer) AddUniqueIndex(symbol EntitySymbol) ReadIndex
- func (indexer *Indexer) InitializeIndexes(tx *bbolt.Tx, errorHolder errorz.ErrorHolder)
- func (indexer *Indexer) NewIndexingContext(isCreate bool, tx *bbolt.Tx, id string, holder errorz.ErrorHolder) *IndexingContext
- func (indexer *Indexer) ProcessAfterUpdate(ctx *IndexingContext)
- func (indexer *Indexer) ProcessBeforeUpdate(ctx *IndexingContext)
- func (indexer *Indexer) ProcessDelete(ctx *IndexingContext)
- type IndexingContext
- 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) 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 ReverseBoltCursor
- type Row
- type RowComparator
- type RowContext
- type RowCursor
- type RuntimeEntitySetSymbol
- type Scanner
- type SetChangeListener
- type SetReadIndex
- type SymbolMapper
- type TestContext
- type TypedBucket
- 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) Extended() *TypedBucket
- 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) 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) 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) IsKeyPresent(key []byte) bool
- func (bucket *TypedBucket) IsStringListEmpty(name string) bool
- func (bucket *TypedBucket) OpenCursor(_ *bbolt.Tx, forward bool) ast.SetCursor
- func (bucket *TypedBucket) OpenTypedCursor(_ *bbolt.Tx, forward bool) ast.SetCursor
- func (bucket *TypedBucket) ProceedWithSet(name string, checker FieldChecker) bool
- 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) 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
Constants ¶
View Source
const ( RootBucket = "ziti" IndexesBucket = "indexes" )
View Source
const ( EventCreate events.EventName = "CREATE" EventDelete events.EventName = "DELETE" EventUpdate events.EventName = "UPDATE" FieldId = "id" FieldCreatedAt = "createdAt" FieldUpdatedAt = "updatedAt" FieldTags = "tags" )
View Source
const MaxLinkedSetKeySize = 4096
View Source
const (
SortMax = 5
)
Variables ¶
View Source
var FieldTypeNames = map[FieldType]string{ TypeBool: "TypeBool", TypeInt32: "TypeInt32", TypeInt64: "TypeInt64", TypeFloat64: "TypeFloat64", TypeString: "TypeString", TypeTime: "TypeTime", TypeNil: "TypeNil", }
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 FieldToInt64 ¶
func FieldToString ¶
func GetSingularEntityType ¶
func IsErrNotFoundErr ¶
func NewNotFoundError ¶
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 ExtEntityFields }
func NewExtEntity ¶
func NewExtEntity(id string, tags map[string]interface{}) *BaseExtEntity
func (*BaseExtEntity) GetId ¶
func (entity *BaseExtEntity) GetId() string
func (*BaseExtEntity) SetId ¶
func (entity *BaseExtEntity) SetId(id string)
type BaseStore ¶
type BaseStore struct { Indexer events.EventEmmiter // contains filtered or unexported fields }
func NewBaseStore ¶
func NewChildBaseStore ¶ added in v0.11.2
func (*BaseStore) AddDeleteHandler ¶
func (store *BaseStore) AddDeleteHandler(handler EntityChangeHandler)
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) AddSetSymbol ¶
func (store *BaseStore) AddSetSymbol(name string, nodeType ast.NodeType) EntitySetSymbol
func (*BaseStore) AddSymbolWithKey ¶
func (*BaseStore) BaseLoadOneById ¶
func (*BaseStore) BaseLoadOneByQuery ¶
func (*BaseStore) BaseLoadOneChildById ¶
func (*BaseStore) CleanupExternal ¶
func (store *BaseStore) CleanupExternal(ctx MutateContext, id string) 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) 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) GetRelatedEntitiesCursor ¶
func (*BaseStore) GetRelatedEntitiesIdList ¶
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) 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) MapSymbol ¶
func (store *BaseStore) MapSymbol(name string, mapper SymbolMapper)
func (*BaseStore) NewEntitySymbol ¶
func (store *BaseStore) NewEntitySymbol(name string, nodeType ast.NodeType) EntitySymbol
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.T) *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) 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) 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)
func (*BaseTestContext) ValidateDeleted ¶
func (ctx *BaseTestContext) ValidateDeleted(id string)
func (*BaseTestContext) ValidateUpdated ¶
func (ctx *BaseTestContext) ValidateUpdated(entity ExtEntity)
type BoltVisitor ¶
type Constraint ¶
type Constraint interface { ProcessBeforeUpdate(ctx *IndexingContext) ProcessAfterUpdate(ctx *IndexingContext) ProcessDelete(ctx *IndexingContext) Initialize(tx *bbolt.Tx, errorHolder errorz.ErrorHolder) }
type CrudStore ¶
type CrudStore interface { ListStore GetParentStore() CrudStore AddLinkCollection(local EntitySymbol, remove EntitySymbol) LinkCollection GetLinkCollection(name string) LinkCollection 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 CleanupExternal(ctx MutateContext, id 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) events.EventEmmiter }
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 ExtEntityFields ¶
type ExtEntityFields struct { CreatedAt time.Time UpdatedAt time.Time Tags map[string]interface{} Migrate bool }
func (*ExtEntityFields) CreateBaseValues ¶
func (entity *ExtEntityFields) CreateBaseValues(bucket *TypedBucket)
func (*ExtEntityFields) GetCreatedAt ¶
func (entity *ExtEntityFields) GetCreatedAt() time.Time
func (*ExtEntityFields) GetTags ¶
func (entity *ExtEntityFields) GetTags() map[string]interface{}
func (*ExtEntityFields) GetUpdatedAt ¶
func (entity *ExtEntityFields) GetUpdatedAt() time.Time
func (*ExtEntityFields) LoadBaseValues ¶
func (entity *ExtEntityFields) LoadBaseValues(bucket *TypedBucket)
func (*ExtEntityFields) SetBaseValues ¶
func (entity *ExtEntityFields) SetBaseValues(ctx *PersistContext)
func (*ExtEntityFields) SetCreatedAt ¶
func (entity *ExtEntityFields) SetCreatedAt(createdAt time.Time)
func (*ExtEntityFields) SetTags ¶
func (entity *ExtEntityFields) SetTags(tags map[string]interface{})
func (*ExtEntityFields) SetUpdatedAt ¶
func (entity *ExtEntityFields) SetUpdatedAt(updatedAt time.Time)
func (*ExtEntityFields) UpdateBaseValues ¶
func (entity *ExtEntityFields) UpdateBaseValues(bucket *TypedBucket, fieldChecker FieldChecker)
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()
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
func NewIndexer ¶
func (*Indexer) AddFkIndex ¶
func (indexer *Indexer) AddFkIndex(symbol EntitySymbol, fkSymbol EntitySetSymbol)
func (*Indexer) AddNullableFkIndex ¶
func (indexer *Indexer) AddNullableFkIndex(symbol EntitySymbol, fkSymbol EntitySetSymbol)
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)
func (*Indexer) NewIndexingContext ¶
func (indexer *Indexer) NewIndexingContext(isCreate bool, tx *bbolt.Tx, id string, holder errorz.ErrorHolder) *IndexingContext
func (*Indexer) ProcessAfterUpdate ¶
func (indexer *Indexer) ProcessAfterUpdate(ctx *IndexingContext)
func (*Indexer) ProcessBeforeUpdate ¶
func (indexer *Indexer) ProcessBeforeUpdate(ctx *IndexingContext)
func (*Indexer) ProcessDelete ¶
func (indexer *Indexer) ProcessDelete(ctx *IndexingContext)
type IndexingContext ¶
type LinkCollection ¶
type LinkCollection interface { AddLinks(tx *bbolt.Tx, id string, keys ...string) error RemoveLinks(tx *bbolt.Tx, id string, keys ...string) error SetLinks(tx *bbolt.Tx, id string, keys []string) error GetLinks(tx *bbolt.Tx, id string) []string EntityDeleted(tx *bbolt.Tx, id string) error GetFieldSymbol() EntitySymbol GetLinkedSymbol() EntitySymbol }
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 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 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 AddFkSetSymbol(name string, linkedType ListStore) EntitySetSymbol NewEntitySymbol(name string, nodeType ast.NodeType) EntitySymbol AddExtEntitySymbols() 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) // 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
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) }
func NewMutateContext ¶
func NewMutateContext(tx *bbolt.Tx) 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 { 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 ReverseBoltCursor ¶
type ReverseBoltCursor struct {
BaseBoltCursor
}
func (*ReverseBoltCursor) Next ¶
func (f *ReverseBoltCursor) Next()
type RowComparator ¶
type RowContext ¶
type RowContext struct {
// contains filtered or unexported fields
}
type RuntimeEntitySetSymbol ¶
type SetChangeListener ¶
type SetChangeListener func(tx *bbolt.Tx, 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 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) 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) Extended ¶
func (bucket *TypedBucket) Extended() *TypedBucket
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) 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) 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) IsKeyPresent ¶
func (bucket *TypedBucket) IsKeyPresent(key []byte) bool
func (*TypedBucket) IsStringListEmpty ¶
func (bucket *TypedBucket) IsStringListEmpty(name string) bool
func (*TypedBucket) OpenCursor ¶
func (*TypedBucket) OpenTypedCursor ¶
func (*TypedBucket) ProceedWithSet ¶
func (bucket *TypedBucket) ProceedWithSet(name string, checker FieldChecker) bool
func (*TypedBucket) PutMap ¶
func (bucket *TypedBucket) PutMap(name string, value map[string]interface{}, checker FieldChecker) *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) 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
}
func (*TypedForwardBoltCursor) Next ¶
func (f *TypedForwardBoltCursor) Next()
type TypedReverseBoltCursor ¶
type TypedReverseBoltCursor struct {
BaseBoltCursor
}
func (*TypedReverseBoltCursor) Next ¶
func (f *TypedReverseBoltCursor) Next()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.