couchdbstore

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 14 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) CreateIndex added in v0.1.3

func (c *CouchDBStore) CreateIndex(createIndexRequest storage.CreateIndexRequest) error

CreateIndex creates an index based on the provided CreateIndexRequest. createIndexRequest.IndexStorageLocation refers to the design doc that the index should get placed in. createIndexRequest.IndexName is the name for the index that will be stored in CouchDB. createIndexRequest.WhatToIndex must be a valid index object as defined here:

http://docs.couchdb.org/en/stable/api/database/find.html#db-index

func (*CouchDBStore) Delete added in v0.1.4

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

Delete deletes the key-value pair associated with k.

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) GetAll added in v0.1.4

func (c *CouchDBStore) GetAll() (map[string][]byte, error)

GetAll fetches all the key-value pairs within this store. TODO: #61 Add support for pagination

func (*CouchDBStore) Put

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

Put stores the given key-value pair in the store. If an existing document is found, it will be overwritten.

func (*CouchDBStore) Query added in v0.1.3

func (c *CouchDBStore) Query(findQuery string) (storage.ResultsIterator, error)

Query executes a query using the CouchDB _find endpoint.

type Option added in v0.1.3

type Option func(opts *Provider)

Option configures the couchdb provider

func WithDBPrefix added in v0.1.3

func WithDBPrefix(dbPrefix string) Option

WithDBPrefix option is for adding prefix to db name

type Provider

type Provider struct {
	// 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

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

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

CreateStore creates a new store with the given name.

func (*Provider) OpenStore

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

OpenStore opens an existing store with the given name and returns it. If the store has been previously opened, it will be returned it from the local cache. Note that if the underlying database was deleted by an external force, (i.e. not by using the CloseStore() method) then this local cache will be invalid. To make it valid again, either a new Provider object needs to be created, or Provider.CreateStore() needs to be called again with the same store name. TODO address this: #51

Jump to

Keyboard shortcuts

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