Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct { ID string // contains filtered or unexported fields }
Collection represents a location in the database that holds keys and values This can be nested inside other Collections
func NewCollection ¶
func NewCollection(paths []string, txn DBTxn, parent *Collection) (*Collection, error)
NewCollection recursively creates a collection starting at the given root
func (*Collection) Collection ¶
func (c *Collection) Collection(id string) (*Collection, error)
Collection creates a nested collection
func (*Collection) Get ¶
func (c *Collection) Get(key string, v interface{}) (bool, error)
Get returns a value from the collection by its key
func (*Collection) Path ¶
func (c *Collection) Path(path ...string) []string
Path returns the path to the collection by traversing it's parents IDs
func (*Collection) Put ¶
func (c *Collection) Put(key string, v interface{}) error
Put sets a value in the collection by its key
type DBRoot ¶
DBRoot an interface that describes a database storage root allowing you to store and retrieve data
type DBTxn ¶
type DBTxn interface { Bucket(key []byte) *bolt.Bucket CreateBucketIfNotExists(key []byte) (*bolt.Bucket, error) }
DBTxn an interface that describes a database storage root allow you to create nested roots
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database a storage interface
func (*Database) Collection ¶
func (d *Database) Collection(path string, txn DBTxn) (*Collection, error)
Collection creates a collection from the root at the given path Use a `/` to create a nested collection
func (*Database) Transaction ¶
Transaction starts a transaction