couchdbstore

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CouchDBStore

type CouchDBStore struct {
	// contains filtered or unexported fields
}

CouchDBStore represents a CouchDB-backed database.

func (*CouchDBStore) Delete

func (c *CouchDBStore) Delete(k string) error

Delete will delete record with k key.

func (*CouchDBStore) Get

func (c *CouchDBStore) Get(k string) ([]byte, error)

Get retrieves the value in the store associated with the given key.

func (*CouchDBStore) Iterator

func (c *CouchDBStore) Iterator(startKey, endKey string) storage.StoreIterator

Iterator returns iterator for the latest snapshot of the underlying db.

func (*CouchDBStore) Put

func (c *CouchDBStore) Put(k string, v []byte) error

Put stores the given key-value pair in the store.

type Option

type Option func(opts *Provider)

Option configures the couchdb provider.

func WithDBPrefix

func WithDBPrefix(dbPrefix string) Option

WithDBPrefix option is for adding prefix to db name.

type Provider

type Provider struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Provider represents an CouchDB implementation of the storage.Provider interface.

func NewProvider

func NewProvider(hostURL string, opts ...Option) (*Provider, error)

NewProvider instantiates Provider. Certain stores like couchdb cannot accept key IDs with '_' prefix, to avoid getting errors with such values, key ID need to be base58 encoded for these stores. In order to do so, the store must be wrapped using base58wrapper.

func (*Provider) Close

func (p *Provider) Close() error

Close closes the provider.

func (*Provider) CloseStore

func (p *Provider) CloseStore(name string) error

CloseStore closes a previously opened store.

func (*Provider) OpenStore

func (p *Provider) OpenStore(name string) (storage.Store, error)

OpenStore opens an existing store with the given name and returns it.

Jump to

Keyboard shortcuts

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