Documentation ¶
Index ¶
- type BoltDB
- func (b *BoltDB) Close() error
- func (b *BoltDB) Delete(bucket []byte, key []byte) error
- func (b *BoltDB) DeleteBucket(bucket []byte) error
- func (b *BoltDB) Get(bucket []byte, key []byte) (value []byte, err error)
- func (b *BoltDB) GetBucket(bucket []byte) (buck *Bucket, err error)
- func (b *BoltDB) InitDB(filename string) (err error)
- func (b *BoltDB) Put(bucket []byte, key []byte, value []byte) error
- type Bucket
- type DB
- type KeyValue
- type MemoryDB
- func (b *MemoryDB) Close() error
- func (b *MemoryDB) Delete(bucket []byte, key []byte) (err error)
- func (b *MemoryDB) DeleteBucket(bucket []byte) error
- func (b *MemoryDB) Get(bucket []byte, key []byte) (value []byte, err error)
- func (b *MemoryDB) GetBucket(bucket []byte) (buck *Bucket, err error)
- func (b *MemoryDB) InitDB(string) (err error)
- func (b *MemoryDB) Put(bucket []byte, key []byte, value []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltDB ¶
type BoltDB struct {
// contains filtered or unexported fields
}
func (*BoltDB) DeleteBucket ¶
DeleteBucket will delete all key/value pairs from a bucket
type Bucket ¶
type Bucket struct { KeyValueList []KeyValue //KeyValueList contains the key/value data for the entry // contains filtered or unexported fields }
Bucket is the structure to store the key/value data and a reference map to pull it.
func NewBucket ¶
func NewBucket() *Bucket
NewBucket creates a new instance of the bucket and initializes the map
type DB ¶
type DB interface { Close() error // Returns an error if the close fails InitDB(filepath string) error // Sets up the database, returns error if it fails Get(bucket []byte, key []byte) (value []byte, err error) // Get key from database, returns ErrNotFound if the key is not found Put(bucket []byte, key []byte, value []byte) error // Put the value in the database, throws an error if fails GetBucket(bucket []byte) (*Bucket, error) // GetBucket retrieves all the data contained within a bucket Delete(bucket []byte, key []byte) error // Delete will remove a key/value pair from the bucket DeleteBucket(bucket []byte) error // DeleteBucket will delete all key/value pairs from a bucket }
DB defines the interface functions to access the database
type MemoryDB ¶
type MemoryDB struct {
// contains filtered or unexported fields
}
MemoryDB holds the main map of buckets for the in-memory database
func (*MemoryDB) DeleteBucket ¶
DeleteBucket will delete all key/value pairs from a bucket
Click to show internal directories.
Click to hide internal directories.