couchdb

package
v0.0.0-...-adb44b8 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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

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

Jump to

Keyboard shortcuts

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