Documentation
¶
Index ¶
- Constants
- type BaseIndexer
- type EntKeySetter
- type EntStore
- func (es *EntStore[T]) AddIndex(name string, multi bool, fn func(T) []byte) StoreIndex[T]
- func (es *EntStore[T]) AddIndexer(idx Indexer[T]) StoreIndex[T]
- func (es *EntStore[T]) Get(key []byte) (found bool, ent T, err error)
- func (es *EntStore[T]) GetIter(i liter.Iter[[]byte], buf []T) ([]T, error)
- func (es *EntStore[T]) GetSlice(fn filter.Filter[[]byte], buf []T) ([]T, error)
- func (es *EntStore[T]) Index(name string) (StoreIndex[T], bool)
- func (es *EntStore[T]) Load(ent T) error
- func (es *EntStore[T]) Put(ent T, buf []byte) ([]byte, error)
- type Entity
- type Indexer
- type StoreIndex
- func (si StoreIndex[E]) Lookup(idxKey []byte) (entIds liter.Iter[[]byte], err error)
- func (si StoreIndex[E]) LookupEnts(idxKey []byte) (ents slice.Slice[E], err error)
- func (si StoreIndex[E]) MultiEntLookup(idxKeys liter.Iter[[]byte]) (ents slice.Slice[E], err error)
- func (si StoreIndex[E]) MultiLookup(idxKeys liter.Iter[[]byte]) (entIds liter.Iter[[]byte], err error)
- func (si StoreIndex[E]) Search(f filter.Filter[[]byte]) (idxKeys liter.Iter[[]byte], err error)
- func (si StoreIndex[E]) SearchEnts(f filter.Filter[[]byte]) (ents slice.Slice[E], err error)
Constants ¶
View Source
const ( // ErrKeyNotFound is returned by Load when the key is not found the Store. ErrKeyNotFound = lerr.Str("key not found") // ErrIndexNotFound ErrIndexNotFound = lerr.Str("index not found") ErrIndexNameBlank = lerr.Str("index name was blank") ErrIndexAlreadyDefined = lerr.Str("an index with the given name already exists") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseIndexer ¶
func (BaseIndexer[E]) IndexKey ¶
func (bi BaseIndexer[E]) IndexKey(e E) []byte
func (BaseIndexer[E]) Multi ¶
func (bi BaseIndexer[E]) Multi() bool
func (BaseIndexer[E]) Name ¶
func (bi BaseIndexer[E]) Name() string
type EntKeySetter ¶
type EntKeySetter interface {
SetEntKey([]byte)
}
EntKeySetter can optionally be fulfilled by an Entity. If it is fulfilled, it will be invoked whenever an Entity is deserialized from a Store.
type EntStore ¶
type EntStore[T Entity] struct { Init func() T store.Store serial.Serializer serial.Deserializer IdxStore store.Store // contains filtered or unexported fields }
EntStore provides methods for saving and retreiving and Entity from a Store. The Serializer and Deserializer will be used for the Entity Value while EntKey will be used for the key.
func (*EntStore[T]) AddIndex ¶
func (es *EntStore[T]) AddIndex(name string, multi bool, fn func(T) []byte) StoreIndex[T]
func (*EntStore[T]) AddIndexer ¶
func (es *EntStore[T]) AddIndexer(idx Indexer[T]) StoreIndex[T]
func (*EntStore[T]) GetSlice ¶
GetSlice returns all entities in the Store if fn is nil and if fn is defined it returns all entities for which fn returns true given their key. If buf is provided, it will be used as the return slice.
type StoreIndex ¶
type StoreIndex[E Entity] struct { // contains filtered or unexported fields }
func (StoreIndex[E]) LookupEnts ¶
func (si StoreIndex[E]) LookupEnts(idxKey []byte) (ents slice.Slice[E], err error)
func (StoreIndex[E]) MultiEntLookup ¶
func (StoreIndex[E]) MultiLookup ¶
func (StoreIndex[E]) SearchEnts ¶
Click to show internal directories.
Click to hide internal directories.