Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsIndexExists ¶
IsIndexExists returns true if the error indicates that the index to be created already exists.
Types ¶
type Index ¶
type Index struct {
// Fields is a list of fields to index
Fields []string `json:"fields"`
// Name is the name of the index. Optional.
Name string `json:"name,omitifempty"`
// Design document name (i.e. the part after "_design/"). Optional.
Ddoc string `json:"ddoc,omitifempty"`
// Type specifies the index type. Only 'json' is supported. Optional.
Type string `json:"type,omitifempty"`
}
Index defines an index to be created
type IndexDef ¶
type IndexDef struct {
Ddoc string `json:"ddoc"`
Name string `json:"name"`
Type string `json:"type"`
Def struct {
Fields []map[string]string `json:"fields"`
} `json:"def"`
}
IndexDef describes an index as fetched from the database
type PouchPluginFind ¶
func New ¶
func New(db *pouchdb.PouchDB) *PouchPluginFind
New loads the pouchdb-find plugin (if not already loaded) and returns a plugin instance.
func (*PouchPluginFind) CreateIndex ¶
func (db *PouchPluginFind) CreateIndex(index Index) error
Creates the requested index.
See https://github.com/nolanlawson/pouchdb-find#dbcreateindexindex--callback
func (*PouchPluginFind) DeleteIndex ¶
func (db *PouchPluginFind) DeleteIndex(index *IndexDef) error
DeleteIndex deletes the requested index.
See https://github.com/nolanlawson/pouchdb-find#dbdeleteindexindex--callback
func (*PouchPluginFind) Find ¶
func (db *PouchPluginFind) Find(request map[string]interface{}, docs interface{}) error
Find performs the requested search query
See https://github.com/nolanlawson/pouchdb-find#dbfindrequest--callback
func (*PouchPluginFind) GetIndexes ¶
func (db *PouchPluginFind) GetIndexes() ([]*IndexDef, error)
GetIndex returns a list of existing indexes.
See https://github.com/nolanlawson/pouchdb-find#dbgetindexescallback