Documentation ¶
Index ¶
- Constants
- Variables
- func AND(s1 []uint64, s2 []uint64) []uint64
- func Initialize(path string, options *bolt.Options)
- func KeyInt(v uint64) []byte
- func NOTIN(s1 []uint64, s2 []uint64) []uint64
- func NewInstance(path string, options *bolt.Options) (*bolt.DB, error)
- func OR(s1 []uint64, s2 []uint64) []uint64
- type Collection
- func (c Collection) Delete(key []byte) error
- func (c Collection) Fetch(id uint64) ([]byte, error)
- func (c Collection) FetchAll() ([][]byte, error)
- func (c Collection) FetchBy(key []byte) ([]byte, error)
- func (c Collection) Save(item CollectionItem) (uint64, error)
- func (c Collection) SaveAs(key []byte, item interface{}) error
- func (c Collection) Update(item CollectionItem) error
- type CollectionItem
Constants ¶
View Source
const InMemoryMode = ":memory:"
InMemoryMode used to store ramdom db into temporal folder
Variables ¶
View Source
var DBB *bolt.DB
DBB boltdb instance pointer
View Source
var ErrorBucketNotFound = errors.New("Bucket not found")
ErrorBucketNotFound error type for bucket not found
Functions ¶
func Initialize ¶
Initialize the DBB instance pointer to a valid boltdb
func NewInstance ¶
NewInstance creates a new instance of BoltDB wrapper
Types ¶
type Collection ¶
type Collection struct { //DB is a pointer to bolt DB DB *bolt.DB //Name is the collection name used for bucket name Name string }
Collection sets
func (Collection) Delete ¶
func (c Collection) Delete(key []byte) error
Delete removess an item into collection under key parameter
func (Collection) Fetch ¶
func (c Collection) Fetch(id uint64) ([]byte, error)
Fetch returns an item from collection
func (Collection) FetchAll ¶
func (c Collection) FetchAll() ([][]byte, error)
FetchAll fetch all saved items
func (Collection) FetchBy ¶
func (c Collection) FetchBy(key []byte) ([]byte, error)
FetchBy returns an item from collection given a key
func (Collection) Save ¶
func (c Collection) Save(item CollectionItem) (uint64, error)
Save an item into collection setting autoincrement ID
func (Collection) SaveAs ¶
func (c Collection) SaveAs(key []byte, item interface{}) error
SaveAs saves an item into collection under key parameter
func (Collection) Update ¶
func (c Collection) Update(item CollectionItem) error
Update an item into collection with current item ID
type CollectionItem ¶
CollectionItem is the item into a collection
Click to show internal directories.
Click to hide internal directories.