Versions in this module Expand all Collapse all v1 v1.3.0 Jun 26, 2017 v1.2.1 Jan 25, 2017 Changes in this version + const DefaultBaseURL + var ErrBadContentType = errors.New("status 415 - bad content type") + var ErrBadRequest = errors.New("status 400 - bad request") + var ErrBatchValue = errors.New("batch must be 1 or more") + var ErrConflict = errors.New("status 409 - conflict") + var ErrExpectationFailed = errors.New("status 417 - expectation failed") + var ErrForbidden = errors.New("status 403 - forbidden") + var ErrInternalServerError = errors.New("status 500 - internal server error") + var ErrLimitValue = errors.New("limit must be 1 or more") + var ErrNotAcceptable = errors.New("status 406 - not acceptable") + var ErrNotDocumentEmbedded = errors.New("value not Document-embedded") + var ErrNotFound = errors.New("status 404 - not found") + var ErrNotModified = errors.New("status 304 - not modified") + var ErrNotStruct = errors.New("value not of struct type") + var ErrPreconditionFailed = errors.New("status 412 - precondition failed") + var ErrRequestRangeNotSatisfiable = errors.New("status 416 - requested range not satisfiable") + var ErrResourceNotAllowed = errors.New("status 405 - resource not allowed") + var ErrSetID = errors.New("id can only be set on new documents") + var ErrUnauthorized = errors.New("status 401 - unauthorized") + func FromJSONCompatibleMap(obj interface{}, docMap map[string]interface{}) error + func GenerateUUID() string + func Load(db *Database, docID string, obj interface{}) error + func Store(db *Database, obj interface{}) error + func ToJSONCompatibleMap(obj interface{}) (map[string]interface{}, error) + type Database struct + func NewDatabase(urlStr string) (*Database, error) + func NewDatabaseWithResource(res *Resource) (*Database, error) + func (d *Database) Available() error + func (d *Database) Changes(options url.Values) (map[string]interface{}, error) + func (d *Database) Cleanup() error + func (d *Database) Commit() error + func (d *Database) Compact() error + func (d *Database) Contains(docid string) error + func (d *Database) Copy(srcID, destID, destRev string) (string, error) + func (d *Database) Delete(docid string) error + func (d *Database) DeleteAttachment(doc map[string]interface{}, name string) error + func (d *Database) DeleteDoc(doc map[string]interface{}) error + func (d *Database) DeleteIndex(ddoc, name string) error + func (d *Database) DocIDs() ([]string, error) + func (d *Database) Get(docid string, options url.Values) (map[string]interface{}, error) + func (d *Database) GetAttachment(doc map[string]interface{}, name string) ([]byte, error) + func (d *Database) GetAttachmentID(docid, name string) ([]byte, error) + func (d *Database) GetIndex() (map[string]*json.RawMessage, error) + func (d *Database) GetRevsLimit() (int, error) + func (d *Database) GetSecurity() (map[string]interface{}, error) + func (d *Database) Info(ddoc string) (map[string]interface{}, error) + func (d *Database) IterView(name string, batch int, wrapper func(Row) Row, options map[string]interface{}) (<-chan Row, error) + func (d *Database) Len() (int, error) + func (d *Database) List(name, view string, options map[string]interface{}) (http.Header, []byte, error) + func (d *Database) Name() (string, error) + func (d *Database) Purge(docs []map[string]interface{}) (map[string]interface{}, error) + func (d *Database) PutAttachment(doc map[string]interface{}, content []byte, name, mimeType string) error + func (d *Database) PutIndex(indexFields []string, ddoc, name string) (string, string, error) + func (d *Database) Query(fields []string, selector string, sorts []string, ...) ([]map[string]interface{}, error) + func (d *Database) QueryJSON(query string) ([]map[string]interface{}, error) + func (d *Database) Revisions(docid string, options url.Values) ([]map[string]interface{}, error) + func (d *Database) Save(doc map[string]interface{}, options url.Values) (string, string, error) + func (d *Database) Set(docid string, doc map[string]interface{}) error + func (d *Database) SetRevsLimit(limit int) error + func (d *Database) SetSecurity(securityDoc map[string]interface{}) error + func (d *Database) Show(name, docID string, params url.Values) (http.Header, []byte, error) + func (d *Database) String() string + func (d *Database) Update(docs []map[string]interface{}, options map[string]interface{}) ([]UpdateResult, error) + func (d *Database) UpdateDoc(name, docID string, params url.Values) (http.Header, []byte, error) + func (d *Database) View(name string, wrapper func(Row) Row, options map[string]interface{}) (*ViewResults, error) + type Document struct + ID string + Rev string + func DocumentWithID(id string) Document + func (d *Document) GetID() string + func (d *Document) GetRev() string + func (d *Document) SetID(id string) error + func (d *Document) SetRev(rev string) + type Resource struct + func NewResource(urlStr string, header http.Header) (*Resource, error) + func (r *Resource) Delete(path string, header http.Header, params url.Values) (http.Header, []byte, error) + func (r *Resource) DeleteJSON(path string, header http.Header, params url.Values) (http.Header, []byte, error) + func (r *Resource) Get(path string, header http.Header, params url.Values) (http.Header, []byte, error) + func (r *Resource) GetJSON(path string, header http.Header, params url.Values) (http.Header, []byte, error) + func (r *Resource) Head(path string, header http.Header, params url.Values) (http.Header, []byte, error) + func (r *Resource) NewResourceWithURL(resStr string) (*Resource, error) + func (r *Resource) Post(path string, header http.Header, body []byte, params url.Values) (http.Header, []byte, error) + func (r *Resource) PostJSON(path string, header http.Header, body map[string]interface{}, ...) (http.Header, []byte, error) + func (r *Resource) Put(path string, header http.Header, body []byte, params url.Values) (http.Header, []byte, error) + func (r *Resource) PutJSON(path string, header http.Header, body map[string]interface{}, ...) (http.Header, []byte, error) + type Row struct + Doc interface{} + Err error + ID string + Key interface{} + Val interface{} + func (r Row) String() string + type Server struct + func NewServer(urlStr string) (*Server, error) + func NewServerNoFullCommit(urlStr string) (*Server, error) + func (s *Server) ActiveTasks() ([]interface{}, error) + func (s *Server) AddUser(name, password string, roles []string) (string, string, error) + func (s *Server) Config(node string) (map[string]map[string]string, error) + func (s *Server) Contains(name string) bool + func (s *Server) Create(name string) (*Database, error) + func (s *Server) DBs() ([]string, error) + func (s *Server) Delete(name string) error + func (s *Server) Get(name string) (*Database, error) + func (s *Server) Len() (int, error) + func (s *Server) Login(name, password string) (string, error) + func (s *Server) Logout(token string) error + func (s *Server) Membership() ([]string, []string, error) + func (s *Server) RemoveUser(name string) error + func (s *Server) Replicate(source, target string, options map[string]interface{}) (map[string]interface{}, error) + func (s *Server) Stats(node, entry string) (map[string]interface{}, error) + func (s *Server) String() string + func (s *Server) UUIDs(count int) ([]string, error) + func (s *Server) VerifyToken(token string) error + func (s *Server) Version() (string, error) + type UpdateResult struct + Err error + ID string + Rev string + func SyncMany(db *Database, viewDefns []*ViewDefinition, removeMissing bool, ...) ([]UpdateResult, error) + type ViewDefinition struct + func NewViewDefinition(design, name, mapFun, reduceFun, language string, wrapper func(Row) Row, ...) (*ViewDefinition, error) + func (vd *ViewDefinition) GetDoc(db *Database) (map[string]interface{}, error) + func (vd *ViewDefinition) Sync(db *Database) ([]UpdateResult, error) + func (vd *ViewDefinition) View(db *Database, options map[string]interface{}) (*ViewResults, error) + type ViewField func() (*ViewDefinition, error) + func NewViewField(design, name, mapFun, reduceFun, language string, wrapper func(Row) Row, ...) ViewField + type ViewResults struct + func (vr *ViewResults) Offset() (int, error) + func (vr *ViewResults) Rows() ([]Row, error) + func (vr *ViewResults) TotalRows() (int, error) + func (vr *ViewResults) UpdateSeq() (int, error)