Documentation
¶
Index ¶
- type CouchDBStore
- func (c *CouchDBStore) CreateIndex(createIndexRequest storage.CreateIndexRequest) error
- func (c *CouchDBStore) Delete(k string) error
- func (c *CouchDBStore) Get(k string) ([]byte, error)
- func (c *CouchDBStore) GetAll() (map[string][]byte, error)
- func (c *CouchDBStore) Put(k string, v []byte) error
- func (c *CouchDBStore) Query(findQuery string) (storage.ResultsIterator, error)
- type Option
- type Provider
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
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 ¶
NewProvider instantiates Provider
func (*Provider) CloseStore ¶
CloseStore closes a previously opened store.
func (*Provider) CreateStore ¶
CreateStore creates a new store with the given name.
func (*Provider) OpenStore ¶
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