camlistore.org: camlistore.org/pkg/sorted/sqlkv Index | Files

package sqlkv

import "camlistore.org/pkg/sorted/sqlkv"

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

Index

Package Files

sqlkv.go

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

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

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 9 packages (graph) and is imported by 72 packages. Updated 2018-01-18. Refresh now. Tools for package owners.