Documentation ¶
Index ¶
- func WithExtractor[I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D]](e schema.PathExtractor[D]) func(*Store[I, D, PD])
- func WithFlatExtractor[I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D]](e schema.PathExtractor[[]byte]) func(*Store[I, D, PD])
- func WithId[I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D]](id I) func(*Object[I, D])
- func WithIdCodec[I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D]](c codec.Codec[I]) func(*Store[I, D, PD])
- func WithIdFunc[I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D]](f func(*D) (I, error)) func(*Store[I, D, PD])
- func WithIndexer[I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D]](name string, idx indexing.Indexer[D]) func(*Store[I, D, PD])
- func WithMetadata[I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D]](m map[string]any) func(*Object[I, D])
- func WithMetadataFunc[I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D]](...) func(*Store[I, D, PD])
- type Iterator
- func (it *Iterator[I, D]) Close()
- func (it *Iterator[I, D]) FetchMeta(b bool) *Iterator[I, D]
- func (it *Iterator[I, D]) Item() *badger.Item
- func (it *Iterator[I, D]) Key() []byte
- func (it *Iterator[I, D]) KeyT() I
- func (it *Iterator[I, D]) Next()
- func (it *Iterator[I, D]) Rewind()
- func (it *Iterator[I, D]) Seek(key []byte)
- func (it *Iterator[I, D]) SeekT(key I)
- func (it *Iterator[I, D]) Valid() bool
- func (it *Iterator[I, D]) Value() (*Object[I, D], error)
- type Object
- type Store
- func (s *Store[I, D, PD]) AddIndexer(name string, idx indexing.Indexer[D]) error
- func (s *Store[I, D, PD]) Delete(id I) error
- func (s *Store[I, D, PD]) Get(id I) (*D, error)
- func (s *Store[I, D, PD]) GetObject(id I) (*Object[I, D], error)
- func (s *Store[I, D, PD]) Indexer(name string) *indexing.Extension[D]
- func (s *Store[I, D, PD]) NewIterator(opts badger.IteratorOptions) *Iterator[I, D]
- func (s *Store[I, D, PD]) Prefix() []byte
- func (s *Store[I, D, PD]) Query(q string) (badgerutils.Iterator[*Object[I, D]], error)
- func (s *Store[I, D, PD]) Set(d D, opts ...func(*Object[I, D])) error
- func (s *Store[I, D, PD]) SetObject(obj *Object[I, D]) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithExtractor ¶
func WithExtractor[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ]( e schema.PathExtractor[D], ) func(*Store[I, D, PD])
WithExtractor is an option to set the extractor.
func WithFlatExtractor ¶
func WithFlatExtractor[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ]( e schema.PathExtractor[[]byte], ) func(*Store[I, D, PD])
WithFlatExtractor is an option to set the flat extractor.
func WithId ¶
func WithId[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ]( id I, ) func(*Object[I, D])
WithId is an option to set the id of the object.
func WithIdCodec ¶
func WithIdCodec[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ]( c codec.Codec[I], ) func(*Store[I, D, PD])
WithIdCodec is an option to set the id codec.
func WithIdFunc ¶
func WithIdFunc[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ]( f func(*D) (I, error), ) func(*Store[I, D, PD])
WithIdFunc is an option to set the id function.
func WithIndexer ¶
func WithIndexer[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ]( name string, idx indexing.Indexer[D], ) func(*Store[I, D, PD])
WithIndexer is an option to add an indexer.
func WithMetadata ¶
func WithMetadata[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ]( m map[string]any, ) func(*Object[I, D])
WithMetadata is an option to set the metadata of the object.
func WithMetadataFunc ¶
func WithMetadataFunc[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ]( f func(_ []byte, _ *D, _ D, oldU, newU *extutil.Metadata) (*extutil.Metadata, error), ) func(*Store[I, D, PD])
WithMetadataFunc is an option to set the metadata function.
Types ¶
type Iterator ¶
type Iterator[I any, D encoding.BinaryMarshaler] struct { // contains filtered or unexported fields }
Iterator is an iterator that unmarshal id, data and optionally fetch metadata.
type Object ¶
type Object[ I any, D encoding.BinaryMarshaler, ] struct { Id *I `json:"id,omitempty"` Data D `json:"data,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` }
Object is a generic object that can be stored in a Store.
type Store ¶
type Store[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ] struct { // contains filtered or unexported fields }
Store is a generic store for objects.
func New ¶
func New[ I any, D encoding.BinaryMarshaler, PD sstore.PointerBinaryUnmarshaler[D], ]( base badgerutils.BadgerStore, opts ...func(*Store[I, D, PD]), ) (*Store[I, D, PD], error)
New creates a new Store.
func (*Store[I, D, PD]) AddIndexer ¶
AddIndexer adds an indexer to the store.
func (*Store[I, D, PD]) NewIterator ¶
func (s *Store[I, D, PD]) NewIterator(opts badger.IteratorOptions) *Iterator[I, D]
NewIterator creates a new iterator over the objects.