Documentation ¶
Overview ¶
Package kvite is a simple embedded K/V store backed by SQLite
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket represents a collection of key/value pairs inside the database.
func (*Bucket) Delete ¶
Delete removes a key from the bucket. If the key does not exist then nothing is done and a nil error is returned.
func (*Bucket) ForEach ¶
ForEach executes a function for each key/value pair in a bucket. If the provided function returns an error then the iteration is stopped and the error is returned to the caller.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a wrapper around the underlying SQLite database.
func Open ¶
Open opens a KVite datastore. The returned DB is safe for concurrent use by multiple goroutines. It is rarely necessary to close a DB.
func (*DB) Close ¶
Close closes the database, releasing any open resources. It is rare to Close a DB, as the DB handle is meant to be long-lived and shared between many goroutines.
func (*DB) Transaction ¶
Transaction executes a function within the context of a managed transaction. If no error is returned from the function then the transaction is committed. If an error is returned then the entire transaction is rolled back. Rollback and Commit cannot be used inside of the function
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx wraps most interactions with the datastore.
func (*Tx) Bucket ¶
Bucket gets a bucket by name. Buckets can be created on the fly and do not "exist" until they have keys.
func (*Tx) CreateBucket ¶
CreateBucket is provided for compatibility. It just calls Bucket.
func (*Tx) CreateBucketIfNotExists ¶
CreateBucketIfNotExists is provided for compatibility. It just calls Bucket.