Documentation
¶
Index ¶
- Constants
- Variables
- type Bucket
- type DB
- func (d *DB) Bucket(name string) (*Bucket, error)
- func (d *DB) Close() error
- func (d *DB) Conn() (*sql.Conn, error)
- func (d *DB) CreateBucket(name string) (*Bucket, error)
- func (d *DB) CreateBucketIfNotExist(name string) (*Bucket, error)
- func (d *DB) Delete(key string) error
- func (d *DB) Get(key string) (string, error)
- func (d *DB) Put(key, value string) error
- type OpenCache
- type OpenConfig
- type OpenJournalMode
- type OpenMode
- type OpenOption
Constants ¶
const ( OpenJournalModeDelete = "delete" OpenJournalModeTruncate = "truncate" OpenJournalModePersist = "persist" OpenJournalModeMemory = "memory" OpenJournalModeWAL = "wal" OpenJournalModeOff = "off" )
const DefaultBucket = "SQKV"
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket is a KV bucket
func (*Bucket) Delete ¶
Delete removes a value from the bucket
func (*Bucket) Get ¶
Get returns a value from the bucket
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is an SQKV database
func Open ¶
func Open(path string, opts ...OpenOption) (*DB, error)
Open opens (or creates) a new SQKV database
func (*DB) Bucket ¶
Bucket gets a bucket by name, or returns nil if it doesn't exist
func (*DB) CreateBucket ¶
CreateBucket creates a new bucket and returns it. Returns an error if the bucket already exists or name is empty.
func (*DB) CreateBucketIfNotExist ¶
CreateBucketIfNotExist creates a new bucket (if it does not exist) and returns it. Returns an error if name is empty.
func (*DB) Delete ¶
Delete removes a value from the default bucket
func (*DB) Get ¶
Get returns a value from the default bucket
type OpenCache ¶
type OpenCache string
OpenCache for setting the cache mode
const ( OpenCachePrivate OpenCache = "private" )
type OpenConfig ¶
type OpenConfig struct { Mode OpenMode Cache OpenCache JournalMode OpenJournalMode }
OpenConfig is a configuration for opening a DB
type OpenOption ¶
type OpenOption func(*OpenConfig)
OpenOption is a func for setting open config values
func WithCache ¶
func WithCache(cache OpenCache) OpenOption
WithCache sets the cache for opening the DB
func WithJournalMode ¶
func WithJournalMode(journalMode OpenJournalMode) OpenOption
WithJournalMode sets the journal mode for the DB