Documentation ¶
Index ¶
- Variables
- type DB
- func (db *DB[V]) AddOrReplace(indexName string, t DataType, newValue V) (id uint32, err error)
- func (db *DB[V]) Close() error
- func (db *DB[V]) Create(t DataType, value ...V) (lastId uint32, err error)
- func (db *DB[V]) Delete(id uint32) (err error)
- func (db *DB[V]) DeleteQuery(params QueryParams) (ids []QueryResult[V], err error)
- func (db *DB[V]) Get(id uint32) (t DataType, value V, err error)
- func (db *DB[V]) ListAllKeys() iter.Seq[[]byte]
- func (db *DB[V]) Query(params QueryParams) iter.Seq[V]
- func (db *DB[V]) QueryComplete(params QueryParams) iter.Seq2[DataType, QueryResult[V]]
- func (db *DB[V]) Update(id uint32, modify func(t DataType, newValue V) (V, error)) (err error)
- func (db *DB[V]) UpdateQuery(params QueryParams, modify func(t DataType, newValue V) (V, error)) (err error)
- func (db *DB[V]) Upsert(indexName string, indexKey []byte, t DataType, ...) (id uint32, err error)
- func (db *DB[V]) View(params QueryParams) iter.Seq[V]
- func (db *DB[V]) ViewWithKeys(params QueryParams) iter.Seq2[[]byte, V]
- type DataType
- type IndexDefinition
- type Options
- type QueryParams
- type QueryResult
- type Type
- type ViewDefinition
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = fmt.Errorf("not found")
Functions ¶
This section is empty.
Types ¶
type DB ¶
func (*DB[V]) AddOrReplace ¶ added in v0.0.4
func (*DB[V]) DeleteQuery ¶ added in v0.0.4
func (db *DB[V]) DeleteQuery(params QueryParams) (ids []QueryResult[V], err error)
DeleteQuery deletes everything that matches the query in a single transaction.
func (*DB[V]) ListAllKeys ¶ added in v0.0.7
ListAllKeys exists mostly for debugging purposes.
func (*DB[V]) QueryComplete ¶ added in v0.0.2
func (db *DB[V]) QueryComplete(params QueryParams) iter.Seq2[DataType, QueryResult[V]]
func (*DB[V]) UpdateQuery ¶ added in v0.0.3
func (db *DB[V]) UpdateQuery(params QueryParams, modify func(t DataType, newValue V) (V, error)) (err error)
func (*DB[V]) ViewWithKeys ¶ added in v0.0.4
func (db *DB[V]) ViewWithKeys(params QueryParams) iter.Seq2[[]byte, V]
type DataType ¶
type DataType uint8 // this is a user-defined type identifier that will be stored to facilitate decoding
type IndexDefinition ¶
type IndexDefinition[V any] struct { // Version should start at 1, increase by 1 on every modification Version int // The DataTypes this index will be applied to, if nil it will apply to all Types []DataType // Function that emits keys to build the index Emit func(t DataType, value V, emit func([]byte)) `json:"-"` // When this index is not used anymore Deleted bool // contains filtered or unexported fields }
type QueryParams ¶
func AnyQuery ¶
func AnyQuery(index string) QueryParams
func ExactQuery ¶ added in v0.0.3
func ExactQuery(index string, indexKey []byte) QueryParams
func PrefixQuery ¶
func PrefixQuery(index string, prefix []byte) QueryParams
type QueryResult ¶ added in v0.0.2
type ViewDefinition ¶ added in v0.0.3
type ViewDefinition[V any] struct { // Version should start at 1, increase by 1 on every modification Version int // The DataTypes this index will be applied to, if nil it will apply to all Types []DataType // Function that emits keys and values to build the view Emit func(t DataType, value V, emit func(idxkey []byte, t DataType, value V)) `json:"-"` // When this index is not used anymore Deleted bool // contains filtered or unexported fields }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.