Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingValueForIndex = fmt.Errorf("object is missing a value for this index")
Functions ¶
func IndexFromTimeQuery ¶
IndexFromTimeQuery can be used as a memdb.Indexer query via ReadIndex and allows querying by time.
Types ¶
type IndexBuilder ¶
IndexBuilder is a buffer used to construct memdb index values.
func (*IndexBuilder) Bytes ¶
func (b *IndexBuilder) Bytes() []byte
Bytes returns the stored IndexBuilder value as a byte array.
func (*IndexBuilder) Time ¶
func (b *IndexBuilder) Time(t time.Time)
Time is used to write the passed time into the IndexBuilder for use as a memdb index value.
type ReadIndex ¶
ReadIndex implements memdb.Indexer. It exists so that a function can be used to provide the interface.
Unlike memdb.Indexer, a readIndex function accepts only a single argument. To generate an index from multiple values, use a struct type with multiple fields.
type SingleIndexer ¶
type SingleIndexer struct { // readIndex is used by memdb for Txn.Get, Txn.First, and other operations // that read data. ReadIndex // writeIndex is used by memdb for Txn.Insert, Txn.Delete, and other // operations that write data to the index. WriteIndex }
SingleIndexer implements both memdb.Indexer and memdb.SingleIndexer. It may be used in a memdb.IndexSchema to specify functions that generate the index value for memdb.Txn operations.
type WriteIndex ¶
WriteIndex implements memdb.SingleIndexer. It exists so that a function can be used to provide this interface.
Instead of a bool return value, writeIndex expects errMissingValueForIndex to indicate that an index could not be build for the object. It will translate this error into a false value to satisfy the memdb.SingleIndexer interface.
func (WriteIndex) FromObject ¶
func (f WriteIndex) FromObject(raw any) (bool, []byte, error)