Documentation
¶
Index ¶
- type Collection
- func (c *Collection) Close() error
- func (c *Collection) DeleteBy(field string, value string) error
- func (c *Collection) Drop() error
- func (c *Collection) FindBy(field string, value string, data interface{}) error
- func (c *Collection) FindOne(data interface{})
- func (c *Collection) Index(options *IndexOptions) error
- func (c *Collection) Insert(item interface{}) error
- func (c *Collection) PatchBy(field string, value string, patch map[string]interface{}) error
- func (c *Collection) Traverse(f func(data []byte))
- func (c *Collection) TraverseRange(from, to int, f func(row *Row))
- type Command
- type Index
- type IndexOptions
- type Row
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
Rows []*Row
Indexes map[string]Index
// 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) FindBy ¶
func (c *Collection) FindBy(field string, value string, data interface{}) error
func (*Collection) FindOne ¶
func (c *Collection) FindOne(data interface{})
func (*Collection) Index ¶
func (c *Collection) Index(options *IndexOptions) error
Index 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{}) error
TODO: test concurrency
func (*Collection) PatchBy ¶
func (c *Collection) PatchBy(field string, value string, patch map[string]interface{}) 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 IndexOptions ¶
IndexOptions should have attributes like unique, sparse, multikey, sorted, background, etc... Index should be an interface to have multiple indexes implementations, key value, B-Tree, bitmap, geo, cache...
type Row ¶
type Row struct {
I int // position in Rows
Payload json.RawMessage
}
Click to show internal directories.
Click to hide internal directories.