Index | Files

package sqlkv

import ""

Package sqlkv implements the sorted.KeyValue interface using an *sql.DB.


Package Files


type KeyValue Uses

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"
    // (, 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 Uses

func (kv *KeyValue) BeginBatch() sorted.BatchMutation

func (*KeyValue) BeginReadTx Uses

func (kv *KeyValue) BeginReadTx() sorted.ReadTransaction

func (*KeyValue) Close Uses

func (kv *KeyValue) Close() error

func (*KeyValue) CommitBatch Uses

func (kv *KeyValue) CommitBatch(b sorted.BatchMutation) error

func (*KeyValue) Delete Uses

func (kv *KeyValue) Delete(key string) error

func (*KeyValue) Find Uses

func (kv *KeyValue) Find(start, end string) sorted.Iterator

func (*KeyValue) Get Uses

func (kv *KeyValue) Get(key string) (value string, err error)

func (*KeyValue) Set Uses

func (kv *KeyValue) Set(key, value string) error

func (*KeyValue) Wipe Uses

func (kv *KeyValue) Wipe() error

Package sqlkv imports 10 packages (graph) and is imported by 3 packages. Updated 2019-07-24. Refresh now. Tools for package owners.