Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyPath would be returned when path is "". ErrEmptyPath = errors.New("boltdb path required") // ErrEmptyBucket would be returned when bucket is "". ErrEmptyBucket = errors.New("bucket name required") )
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB equals to bolt.DB
func Open ¶
Open creates and opens a database at the given path. If the file does not exist then it will be created automatically. If path is "", it will return ErrEmptyPath.
func (*DB) Close ¶
Close releases all database resources. All transactions must be closed before closing the database.
func (*DB) Get ¶
Get retrieves the value for a key in the bucket. Returns a nil value if the key does not exist or if the key is a nested bucket. The returned value is only valid for the life of the transaction. If bucket is "", it will return ErrEmptyBucket.
func (*DB) Set ¶
Set sets the value for a key in the bucket.If the key exist then its previous value will be overwritten. Supplied value must remain valid for the life of the transaction. If bucket is "", it will return ErrEmptyBucket. Returns an error if the bucket was created from a read-only transaction, if the key is blank, if the key is too large, or if the value is too large.