Documentation ¶
Index ¶
- Constants
- type DbBackendCouch
- func (d *DbBackendCouch) Connect(url string) error
- func (d *DbBackendCouch) Insert(params dragonfruit.QueryParams) (interface{}, error)
- func (d *DbBackendCouch) LoadDefinition(cnf dragonfruit.Conf) (*dragonfruit.Swagger, error)
- func (d *DbBackendCouch) Prep(database string, resource *dragonfruit.Swagger) error
- func (d *DbBackendCouch) Query(params dragonfruit.QueryParams) (dragonfruit.Container, error)
- func (d *DbBackendCouch) Remove(params dragonfruit.QueryParams) error
- func (d *DbBackendCouch) SaveDefinition(sw *dragonfruit.Swagger) error
- func (d *DbBackendCouch) Update(params dragonfruit.QueryParams, operation int) (interface{}, error)
Constants ¶
const ( SwaggerResourceDB = "swagger_docs" ResourceDescriptionName = "swagger_resource" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbBackendCouch ¶
type DbBackendCouch struct {
// contains filtered or unexported fields
}
DbBackendCouch is the exported client that you would use in your app.
func (*DbBackendCouch) Connect ¶
func (d *DbBackendCouch) Connect(url string) error
Connect connects to a couchdb server.
func (*DbBackendCouch) Insert ¶
func (d *DbBackendCouch) Insert(params dragonfruit.QueryParams) (interface{}, error)
Insert adds a new document to the database TODO - Add subdocuments
func (*DbBackendCouch) LoadDefinition ¶
func (d *DbBackendCouch) LoadDefinition(cnf dragonfruit.Conf) (*dragonfruit.Swagger, error)
LoadDescriptionFromDb loads a resource description from a database backend. (see the backend stuff and types).
func (*DbBackendCouch) Prep ¶
func (d *DbBackendCouch) Prep(database string, resource *dragonfruit.Swagger) error
Prep prepares a database to accept API data. In this case, it creates a database (conventionally namped after the base model that's returned and a design document for querying the docs.
There are two types of views in the design document (although all of this is mostly invisible to the front-end):
- query views handle parameters passed via http GETs
- path views handle parameters embedded in a path
the Query method defines access rules and priorities
func (*DbBackendCouch) Query ¶
func (d *DbBackendCouch) Query(params dragonfruit.QueryParams) (dragonfruit.Container, error)
Query queries a view and returns a result
func (*DbBackendCouch) Remove ¶
func (d *DbBackendCouch) Remove(params dragonfruit.QueryParams) error
Remove deletes a document from the database
func (*DbBackendCouch) SaveDefinition ¶
func (d *DbBackendCouch) SaveDefinition(sw *dragonfruit.Swagger) error
LoadDescriptionFromDb loads a resource description from a database backend. (see the backend stuff and types).
func (*DbBackendCouch) Update ¶
func (d *DbBackendCouch) Update(params dragonfruit.QueryParams, operation int) (interface{}, error)
Update updates a document TODO - partial document updates