sqlkv

package
v0.0.0-...-89f6ccf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Index

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) 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL