Documentation
¶
Index ¶
- type CtrlDbCouch
- func (instance *CtrlDbCouch) Close()
- func (instance *CtrlDbCouch) Count(dbName string, query *gg_couchdb.QueryObject) (response int, err error)
- func (instance *CtrlDbCouch) GetDatabase(name string) (response *gg_couchdb.Database, err error)
- func (instance *CtrlDbCouch) IsEnabledDB() bool
- func (instance *CtrlDbCouch) ItemExists(dbName string, id string) (response bool, err error)
- func (instance *CtrlDbCouch) ItemGet(dbName string, id string) (response map[string]interface{}, err error)
- func (instance *CtrlDbCouch) ItemRemoveById(dbName string, id string) (err error)
- func (instance *CtrlDbCouch) ItemSearch(dbName string, query map[string]interface{}) (response []map[string]interface{}, err error)
- func (instance *CtrlDbCouch) ItemUpdate(dbName string, item map[string]interface{}) (id, rev string, err error)
- func (instance *CtrlDbCouch) Len(dbName string) (response int, err error)
- func (instance *CtrlDbCouch) OnDbInit(handler func(name string, database *gg_couchdb.Database))
- func (instance *CtrlDbCouch) Open() (err error)
- func (instance *CtrlDbCouch) Query(dbName string, fields []string, selector string, sorts []string, ...) (response []map[string]interface{}, err error)
- func (instance *CtrlDbCouch) QueryJSON(dbName string, query string) (response []map[string]interface{}, err error)
- func (instance *CtrlDbCouch) Url() (response string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CtrlDbCouch ¶
type CtrlDbCouch struct {
// contains filtered or unexported fields
}
func NewCtrlDbCouch ¶
func NewCtrlDbCouch(args ...interface{}) (instance *CtrlDbCouch, err error)
func (*CtrlDbCouch) Close ¶
func (instance *CtrlDbCouch) Close()
func (*CtrlDbCouch) Count ¶ added in v0.3.71
func (instance *CtrlDbCouch) Count(dbName string, query *gg_couchdb.QueryObject) (response int, err error)
func (*CtrlDbCouch) GetDatabase ¶
func (instance *CtrlDbCouch) GetDatabase(name string) (response *gg_couchdb.Database, err error)
func (*CtrlDbCouch) IsEnabledDB ¶
func (instance *CtrlDbCouch) IsEnabledDB() bool
func (*CtrlDbCouch) ItemExists ¶
func (instance *CtrlDbCouch) ItemExists(dbName string, id string) (response bool, err error)
func (*CtrlDbCouch) ItemGet ¶
func (instance *CtrlDbCouch) ItemGet(dbName string, id string) (response map[string]interface{}, err error)
func (*CtrlDbCouch) ItemRemoveById ¶
func (instance *CtrlDbCouch) ItemRemoveById(dbName string, id string) (err error)
func (*CtrlDbCouch) ItemSearch ¶
func (instance *CtrlDbCouch) ItemSearch(dbName string, query map[string]interface{}) (response []map[string]interface{}, err error)
func (*CtrlDbCouch) ItemUpdate ¶
func (instance *CtrlDbCouch) ItemUpdate(dbName string, item map[string]interface{}) (id, rev string, err error)
func (*CtrlDbCouch) OnDbInit ¶
func (instance *CtrlDbCouch) OnDbInit(handler func(name string, database *gg_couchdb.Database))
func (*CtrlDbCouch) Open ¶
func (instance *CtrlDbCouch) Open() (err error)
func (*CtrlDbCouch) Query ¶
func (instance *CtrlDbCouch) Query(dbName string, fields []string, selector string, sorts []string, limit, skip, index interface{}) (response []map[string]interface{}, err error)
Query returns documents using a conditional selector statement in Golang.
selector: A filter string declaring which documents to return, formatted as a Golang statement.
fields: Specifying which fields to be returned, if passing nil the entire is returned, no automatic inclusion of _id or other metadata fields.
sorts: How to order the documents returned, formatted as ["desc(fieldName1)", "desc(fieldName2)"] or ["fieldNameA", "fieldNameB"] of which "asc" is used by default, passing nil to disable ordering.
limit: Maximum number of results returned, passing nil to use default value(25).
skip: Skip the first 'n' results, where 'n' is the number specified, passing nil for no-skip.
index: Instruct a query to use a specific index, specified either as "<design_document>" or ["<design_document>", "<index_name>"], passing nil to use primary index(_all_docs) by default.
Inner functions for selector syntax ¶
nor(condexprs...) matches if none of the conditions in condexprs match($nor).
For example: nor(year == 1990, year == 1989, year == 1997) returns all documents whose year field not in 1989, 1990 and 1997.
all(field, array) matches an array value if it contains all the elements of the argument array($all).
For example: all(genre, []string{"Comedy", "Short"} returns all documents whose genre field contains "Comedy" and "Short".
any(field, condexpr) matches an array field with at least one element meets the specified condition($elemMatch).
For example: any(genre, genre == "Short" || genre == "Horror") returns all documents whose genre field contains "Short" or "Horror" or both.
exists(field, boolean) checks whether the field exists or not, regardless of its value($exists).
For example: exists(director, false) returns all documents who does not have a director field.
typeof(field, type) checks the document field's type, valid types are "null", "boolean", "number", "string", "array", "object"($type).
For example: typeof(genre, "array") returns all documents whose genre field is of array type.
in(field, array) the field must exist in the array provided($in).
For example: in(director, []string{"Mike Portnoy", "Vitali Kanevsky"}) returns all documents whose director field is "Mike Portnoy" or "Vitali Kanevsky".
nin(field, array) the document field must not exist in the array provided($nin).
For example: nin(year, []int{1990, 1992, 1998}) returns all documents whose year field is not in 1990, 1992 or 1998.
size(field, int) matches the length of an array field in a document($size).
For example: size(genre, 2) returns all documents whose genre field is of length 2.
mod(field, divisor, remainder) matches documents where field % divisor == remainder($mod).
For example: mod(year, 2, 1) returns all documents whose year field is an odd number.
regex(field, regexstr) a regular expression pattern to match against the document field.
For example: regex(title, "^A") returns all documents whose title is begin with an "A".
Inner functions for sort syntax ¶
asc(field) sorts the field in ascending order, this is the default option while desc(field) sorts the field in descending order.
func (*CtrlDbCouch) QueryJSON ¶
func (instance *CtrlDbCouch) QueryJSON(dbName string, query string) (response []map[string]interface{}, err error)
QueryJSON https://docs.couchdb.org/en/latest/api/database/find.html
func (*CtrlDbCouch) Url ¶
func (instance *CtrlDbCouch) Url() (response string)