Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client interface { Use(string) (Database, error) UseOrCreate(string) (Database, error) Destroy(string) error Exists(databaseName string) (bool, error) Info(databaseName string) (*cloudant.Info, error) }
Client is the main interface for Cloudant instance operations
func NewClient ¶
func NewClient(username, password, rootStrURL string, options ...cloudant.ClientOption) (Client, error)
NewClient returns a new Cloudanti client.
func NewMockClient ¶
func NewMockClient(content CloudantContent) (Client, error)
NewMockClient mocks the creation of a new Cloudant instance.
type CloudantContent ¶
type CloudantContent struct {
Databases map[string]DatabaseContent
}
CloudantContent holds content for mock Cloudant instance.
type Database ¶
type Database interface { Get(string, *cloudant.DocQuery, interface{}) error Insert(interface{}) (*cloudant.DocumentMeta, error) InsertEscaped(document interface{}) (*cloudant.DocumentMeta, error) InsertRaw(jsonDocument []byte) (*cloudant.DocumentMeta, error) Destroy(string, string) error List(q *cloudant.ViewQuery) (<-chan []byte, error) View(designName, viewName string, q *cloudant.ViewQuery) (<-chan []byte, error) ViewRaw(string, string, *cloudant.ViewQuery) ([]byte, error) }
Database is an interface for Cloudant database operations
type DatabaseContent ¶
type DatabaseContent struct { Info cloudant.Info Docs map[string][]byte Views map[string][]string // map design URL, e.g. /_design/search~view/_view/versions?descending=true&include_docs=true&key=PLAN-abcd&limit=1 to list of doc IDs from docs }
DatabaseContent holds mock content for mock database.
Click to show internal directories.
Click to hide internal directories.