find

package
v0.0.0-...-472388d Latest Latest
Warning

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

Go to latest
Published: May 1, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIndexExists

func IsIndexExists(err error) bool

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

type PouchPluginFind struct {
	*pouchdb.PouchDB
}

func New

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

Jump to

Keyboard shortcuts

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