Overview ▹
Overview ▾
Package sqlkv implements the sorted.KeyValue interface using an *sql.DB.
Index
- type KeyValue
- func (kv *KeyValue) BeginBatch() sorted.BatchMutation
- func (kv *KeyValue) BeginReadTx() sorted.ReadTransaction
- 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
Package files
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"
    // (perkeep.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) BeginReadTx
func (kv *KeyValue) BeginReadTx() sorted.ReadTransaction
func (*KeyValue) Close
func (kv *KeyValue) Close() error
func (*KeyValue) CommitBatch
func (kv *KeyValue) CommitBatch(b sorted.BatchMutation) error
func (*KeyValue) Delete
func (kv *KeyValue) Delete(key string) error
func (*KeyValue) Find
func (kv *KeyValue) Find(start, end string) sorted.Iterator
func (*KeyValue) Get
func (kv *KeyValue) Get(key string) (value string, err error)
func (*KeyValue) Set
func (kv *KeyValue) Set(key, value string) error
func (*KeyValue) Wipe
func (kv *KeyValue) Wipe() error
