Documentation
¶
Overview ¶
Package sqlkv implements the sorted.KeyValue interface using an *sql.DB.
Index ¶
- type KeyValue
- func (kv *KeyValue) BeginBatch() sorted.BatchMutation
- func (kv *KeyValue) Close() error
- func (kv *KeyValue) CommitBatch(b sorted.BatchMutation) error
- func (kv *KeyValue) Delete(key string) error
- func (kv *KeyValue) Find(start, end string) sorted.Iterator
- func (kv *KeyValue) Get(key string) (value string, err error)
- func (kv *KeyValue) Set(key, value string) error
- func (kv *KeyValue) Wipe() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyValue ¶
type KeyValue struct {
DB *sql.DB
// SetFunc is an optional func to use when REPLACE INTO does not exist
SetFunc func(*sql.DB, string, string) error
BatchSetFunc func(*sql.Tx, string, string) error
// PlaceHolderFunc optionally replaces ? placeholders
// with the right ones for the rdbms in use.
PlaceHolderFunc func(string) string
// Gate optionally limits concurrent access.
//
// This originally existed just for SQLite, whose driver likes
// to return "the database is locked"
// (camlistore.org/issue/114), so this keeps some pressure
// off. But we still trust SQLite to deal with concurrency in
// most cases.
//
// It's also used to limit the number of MySQL connections.
Gate *syncutil.Gate
// TablePrefix optionally provides a prefix for SQL table
// names. This is typically "dbname.", ending in a period.
TablePrefix string
// contains filtered or unexported fields
}
KeyValue implements the sorted.KeyValue interface using an *sql.DB.
func (*KeyValue) BeginBatch ¶
func (kv *KeyValue) BeginBatch() sorted.BatchMutation
func (*KeyValue) CommitBatch ¶
func (kv *KeyValue) CommitBatch(b sorted.BatchMutation) error
Source Files
¶
- sqlkv.go
Click to show internal directories.
Click to hide internal directories.