cloudanti

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(s interface{}, elem interface{}) bool

Contains finds if item exists in an array

func JSONMarshal

func JSONMarshal(t interface{}) ([]byte, error)

JSONMarshal marshals JSON without escaping: needed for keeping unescaped html tags

Types

type Client

type Client interface {
	Use(string) (Database, error)
	UseOrCreate(string) (Database, error)
	Destroy(string) error
}

Client .

func NewClient

func NewClient(username, password, rootStrURL string, options ...cloudant.ClientOption) (Client, error)

NewClient returns a new client (with max. retry 3 using a random 5-30 secs delay).

func NewMockClient

func NewMockClient(content CloudantContent) (Client, error)

NewMockClient mocks the creation of a new Cloudant instance

type CloudantContent

type CloudantContent struct {
	Info      cloudant.Info
	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)
	Destroy(string, string) error
	ViewRaw(string, string, *cloudant.ViewQuery) ([]byte, error)
}

Database .

type DatabaseContent

type DatabaseContent struct {
	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

Jump to

Keyboard shortcuts

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