Documentation
¶
Index ¶
- Variables
- type Client
- func (client *Client) CreateDatabase(name string) (CloudantDocumentResponse, error)
- func (client *Client) DeleteDatabase(name string) (CloudantDocumentResponse, error)
- func (client *Client) GetClusterInfo() (ClusterInfo, error)
- func (client *Client) GetDatabase(name string) Database
- func (client *Client) ListDatabases() ([]string, error)
- type CloudantDocument
- type CloudantDocumentInterfacer
- type CloudantDocumentResponse
- type CloudantError
- type ClusterInfo
- type Database
- func (db *Database) Client() *Client
- func (db *Database) CreateDocument(doc interface{}, isBatch bool) (CloudantDocumentResponse, error)
- func (db *Database) CreateIndex(fields []string, opts map[string]string) (CloudantDocumentResponse, error)
- func (db *Database) DeleteDocument(id string, revision string) (CloudantDocumentResponse, error)
- func (db *Database) DeleteIndexByName(name string) (CloudantDocumentResponse, error)
- func (db *Database) GetDesignDocument(id string) (*DesignDocument, error)
- func (db *Database) GetDocument(id string, doc interface{}) error
- func (db *Database) GetIndexByDDocName(ddocId string) (*DesignDocument, error)
- func (db *Database) GetIndexByName(name string) (*Index, error)
- func (db *Database) GetIndices() ([]Index, error)
- func (db *Database) Name() string
- func (db *Database) Query(q *Query, results interface{}) error
- func (db *Database) UpdateDocument(doc CloudantDocumentInterfacer, isBatch bool) (CloudantDocumentResponse, error)
- type DesignDocument
- type Index
- type Query
- type QueryResults
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { PrintResponses bool // contains filtered or unexported fields }
func NewClientWithTransport ¶
func NewClientWithTransport(rootUri string, apiKey string, apiPassword string, transport *httpclient.Transport) *Client
Like NewClient, except that it allows a specific http.Transport to be provided for use, rather than DefaultTransport.
func (*Client) CreateDatabase ¶
func (client *Client) CreateDatabase(name string) (CloudantDocumentResponse, error)
func (*Client) DeleteDatabase ¶
func (client *Client) DeleteDatabase(name string) (CloudantDocumentResponse, error)
func (*Client) GetClusterInfo ¶
func (client *Client) GetClusterInfo() (ClusterInfo, error)
func (*Client) GetDatabase ¶
func (*Client) ListDatabases ¶
type CloudantDocument ¶
type CloudantDocument struct {
// contains filtered or unexported fields
}
func (*CloudantDocument) Id ¶
func (doc *CloudantDocument) Id() string
func (*CloudantDocument) Revision ¶
func (doc *CloudantDocument) Revision() string
func (*CloudantDocument) SetId ¶
func (doc *CloudantDocument) SetId(id string)
type CloudantError ¶
type CloudantError struct { // The status string returned from the HTTP call. Status string `json:"-"` // The status, as an integer, returned from the HTTP call. StatusCode int `json:"-"` // The Cloudant error id. Code string `json:"error"` // The Cloudant error reason. Detail string `json:"reason"` }
An implementation of 'error' that exposes all the cloudant specific error details.
func NotFoundError ¶
func NotFoundError() *CloudantError
func (*CloudantError) Error ¶
func (e *CloudantError) Error() string
type ClusterInfo ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
func (*Database) CreateDocument ¶
func (db *Database) CreateDocument(doc interface{}, isBatch bool) (CloudantDocumentResponse, error)
func (*Database) CreateIndex ¶
func (db *Database) CreateIndex(fields []string, opts map[string]string) (CloudantDocumentResponse, error)
Create an index on the specified field names
http://docs.cloudant.com/api/cloudant-query.html?highlight=query#creating-a-new-index Options: 1) ddoc_name: name of the design document. auto-generated if not specified 2) index_name: name of the index auto-generate if not specified 3) type: currently, only supported type is json (default). per the docs, full text and geospatial will be available at some point
func (*Database) DeleteDocument ¶
func (db *Database) DeleteDocument(id string, revision string) (CloudantDocumentResponse, error)
func (*Database) DeleteIndexByName ¶
func (db *Database) DeleteIndexByName(name string) (CloudantDocumentResponse, error)
func (*Database) GetDesignDocument ¶
func (db *Database) GetDesignDocument(id string) (*DesignDocument, error)
func (*Database) GetDocument ¶
func (*Database) GetIndexByDDocName ¶
func (db *Database) GetIndexByDDocName(ddocId string) (*DesignDocument, error)
func (*Database) GetIndices ¶
func (*Database) UpdateDocument ¶
func (db *Database) UpdateDocument(doc CloudantDocumentInterfacer, isBatch bool) (CloudantDocumentResponse, error)
type DesignDocument ¶
type DesignDocument struct { CloudantDocument Language string `json:"language"` Views map[string]designDocumentView `json:"views"` }
Container for cloudant design document information http://docs.cloudant.com/api/design-documents-get-put-delete-copy.html
func (*DesignDocument) ViewKeys ¶
func (ddoc *DesignDocument) ViewKeys() []string
type Index ¶
type Index struct { DDocId string `json:"ddoc"` Name string `json:"name"` Type string `json:"type"` Definition indexDefinition `json:"def"` }
Container for cloudant index information http://docs.cloudant.com/api/cloudant-query.html?highlight=query#list-all-indexes
type Query ¶
type Query struct { Selector map[string]interface{} `json:"selector"` Sorters []map[string]string `json:"sort"` Limit int `json:"limit"` Skip int `json:"skip"` }
Container for cloudant query selectors http://docs.cloudant.com/api/cloudant-query.html?highlight=query#selector-syntax
type QueryResults ¶
type QueryResults struct {
Docs interface{} `json:"docs"`
}
Click to show internal directories.
Click to hide internal directories.