Documentation ¶
Index ¶
- type Collection
- func (c *Collection) Close() error
- func (c *Collection) Drop() error
- func (c *Collection) DropIndex(name string) error
- func (c *Collection) FindOne(data interface{})
- func (c *Collection) Index(name string, options interface{}) error
- func (c *Collection) Insert(item interface{}) (*Row, error)
- func (c *Collection) Patch(row *Row, patch interface{}) error
- func (c *Collection) Remove(r *Row) error
- func (c *Collection) SetDefaults(defaults map[string]any) error
- func (c *Collection) Traverse(f func(data []byte))
- func (c *Collection) TraverseRange(from, to int, f func(row *Row))
- type Command
- type CreateIndexCommand
- type CreateIndexOptions
- type DropIndexCommand
- type Index
- type IndexBTreeOptions
- type IndexBtree
- type IndexBtreeTraverse
- type IndexMap
- type IndexMapOptions
- type IndexMapTraverse
- type Row
- type RowOrdered
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct { Filename string // Just informative... Rows []*Row Indexes map[string]*collectionIndex // todo: protect access with mutex or use sync.Map // buffer *bufio.Writer // TODO: use write buffer to improve performance (x3 in tests) Defaults map[string]any // contains filtered or unexported fields }
func OpenCollection ¶
func OpenCollection(filename string) (*Collection, error)
func (*Collection) Close ¶
func (c *Collection) Close() error
func (*Collection) Drop ¶
func (c *Collection) Drop() error
func (*Collection) DropIndex ¶ added in v0.0.4
func (c *Collection) DropIndex(name string) error
func (*Collection) FindOne ¶
func (c *Collection) FindOne(data interface{})
func (*Collection) Index ¶
func (c *Collection) Index(name string, options interface{}) error
IndexMap create a unique index with a name Constraints: values can be only scalar strings or array of strings
func (*Collection) Insert ¶
func (c *Collection) Insert(item interface{}) (*Row, error)
TODO: test concurrency
func (*Collection) Patch ¶ added in v0.0.2
func (c *Collection) Patch(row *Row, patch interface{}) error
func (*Collection) Remove ¶ added in v0.0.2
func (c *Collection) Remove(r *Row) error
func (*Collection) SetDefaults ¶ added in v0.0.7
func (c *Collection) SetDefaults(defaults map[string]any) error
func (*Collection) Traverse ¶
func (c *Collection) Traverse(f func(data []byte))
func (*Collection) TraverseRange ¶
func (c *Collection) TraverseRange(from, to int, f func(row *Row))
type CreateIndexCommand ¶ added in v0.0.3
type CreateIndexOptions ¶ added in v0.0.3
type DropIndexCommand ¶ added in v0.0.4
type DropIndexCommand struct {
Name string `json:"name"`
}
type IndexBTreeOptions ¶ added in v0.0.3
type IndexBtree ¶ added in v0.0.3
type IndexBtree struct { Btree *btree.BTreeG[*RowOrdered] Options *IndexBTreeOptions }
func NewIndexBTree ¶ added in v0.0.3
func NewIndexBTree(options *IndexBTreeOptions) *IndexBtree
func (*IndexBtree) AddRow ¶ added in v0.0.3
func (b *IndexBtree) AddRow(r *Row) error
func (*IndexBtree) RemoveRow ¶ added in v0.0.3
func (b *IndexBtree) RemoveRow(r *Row) error
type IndexBtreeTraverse ¶ added in v0.0.3
type IndexMap ¶ added in v0.0.3
type IndexMap struct { Entries map[string]*Row RWmutex *sync.RWMutex Options *IndexMapOptions }
IndexMap should be an interface to allow multiple kinds and implementations
func NewIndexMap ¶ added in v0.0.3
func NewIndexMap(options *IndexMapOptions) *IndexMap
type IndexMapOptions ¶ added in v0.0.3
IndexMapOptions should have attributes like unique, sparse, multikey, sorted, background, etc... IndexMap should be an interface to have multiple indexes implementations, key value, B-Tree, bitmap, geo, cache...
type IndexMapTraverse ¶ added in v0.0.3
type IndexMapTraverse struct {
Value string `json:"value"`
}
type Row ¶
type Row struct { I int // position in Rows Payload json.RawMessage }
type RowOrdered ¶ added in v0.0.3
type RowOrdered struct { *Row Values []interface{} }
Click to show internal directories.
Click to hide internal directories.