couchdb

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MimeTypeTextPlain        = "text/plain"
	MimeTypeJSON             = "application/json"
	MimeTypeMultipartRelated = "multipart/related"
	MimeTypeOctetStream      = "application/octet-stream"
)

Some MIME types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL  string
	Username string
	Password string

	HTTPClient http.Client
}

Client implements a simple couch db client.

func (*Client) Database

func (c *Client) Database(name string) *DatabaseRef

Database returns a reference to the database with the provided name.

type DatabaseCreateRequest

type DatabaseCreateRequest struct {
	// contains filtered or unexported fields
}

DatabaseCreateRequest defines the database create request.

func (*DatabaseCreateRequest) Do

Do performs the request.

func (*DatabaseCreateRequest) WithContext

WithContext adds a context to the request.

type DatabaseCreateResponse

type DatabaseCreateResponse struct {
	OK     bool   `json:"ok"`
	Error  string `json:"error"`
	Reason string `json:"reason"`
}

DatabaseCreateResponse efines the database create response.

type DatabaseDeleteRequest

type DatabaseDeleteRequest struct {
	// contains filtered or unexported fields
}

DatabaseDeleteRequest defines the database delete request.

func (*DatabaseDeleteRequest) Do

Do performs the request.

func (*DatabaseDeleteRequest) WithContext

WithContext adds a context to the request.

type DatabaseDeleteResponse

type DatabaseDeleteResponse struct {
	OK bool `json:"ok"`
}

DatabaseDeleteResponse defines the database delete response.

type DatabaseRef

type DatabaseRef struct {
	// contains filtered or unexported fields
}

DatabaseRef holds the reference to a database.

func (*DatabaseRef) Create

func (dr *DatabaseRef) Create() *DatabaseCreateRequest

Create returns the database create request.

func (*DatabaseRef) Delete

func (dr *DatabaseRef) Delete() *DatabaseDeleteRequest

Delete returns the database delete request.

func (*DatabaseRef) Document

func (dr *DatabaseRef) Document() *DocumentRef

Document returns a reference to a document in the database.

type Document

type Document map[string]interface{}

Document defines a document.

func (Document) ID

func (d Document) ID() string

ID returns the document's id if defined.

func (Document) Revision

func (d Document) Revision() string

Revision returns the document's revision if defined.

type DocumentCreateRequest

type DocumentCreateRequest struct {
	// contains filtered or unexported fields
}

DocumentCreateRequest defines the document create request.

func (*DocumentCreateRequest) Do

Do performs the request.

func (*DocumentCreateRequest) WithContext

WithContext adds a context to the request.

type DocumentCreateResponse

type DocumentCreateResponse struct {
	OK       bool   `json:"ok"`
	ID       string `json:"id"`
	Revision string `json:"rev"`
}

DocumentCreateResponse defines the document create response.

type DocumentDeleteRequest

type DocumentDeleteRequest struct {
	// contains filtered or unexported fields
}

DocumentDeleteRequest defines the document fetch request.

func (*DocumentDeleteRequest) Do

Do performs the request.

func (*DocumentDeleteRequest) WithContext

WithContext adds a context to the request.

type DocumentDeleteResponse

type DocumentDeleteResponse struct {
	OK       bool   `json:"ok"`
	ID       string `json:"id"`
	Revision string `json:"rev"`
}

DocumentDeleteResponse defines the document create response.

type DocumentFetchMetaRequest

type DocumentFetchMetaRequest struct {
	// contains filtered or unexported fields
}

DocumentFetchMetaRequest defines the document fetch request.

func (*DocumentFetchMetaRequest) Do

Do performs the request.

func (*DocumentFetchMetaRequest) WithContext

WithContext adds a context to the request.

func (*DocumentFetchMetaRequest) WithRevision

func (dfr *DocumentFetchMetaRequest) WithRevision(revision string) *DocumentFetchMetaRequest

WithRevision adds a revision to the request.

type DocumentFetchMetaResponse

type DocumentFetchMetaResponse struct {
	ContentLength uint64
	Revision      string
}

DocumentFetchMetaResponse defines the document create response.

type DocumentFetchRequest

type DocumentFetchRequest struct {
	// contains filtered or unexported fields
}

DocumentFetchRequest defines the document fetch request.

func (*DocumentFetchRequest) Do

Do performs the request.

func (*DocumentFetchRequest) WithContext

WithContext adds a context to the request.

func (*DocumentFetchRequest) WithRevision

func (dfr *DocumentFetchRequest) WithRevision(revision string) *DocumentFetchRequest

WithRevision adds a revision to the request.

type DocumentFetchResponse

type DocumentFetchResponse struct {
	Revision string
	Document Document
}

DocumentFetchResponse defines the document create response.

type DocumentRef

type DocumentRef struct {
	// contains filtered or unexported fields
}

DocumentRef holds the reference to a document.

func (*DocumentRef) Create

func (dr *DocumentRef) Create(document Document) *DocumentCreateRequest

Create returns the document create request.

func (*DocumentRef) Delete

func (dr *DocumentRef) Delete(id, revision string) *DocumentDeleteRequest

Delete returns the document delete request.

func (*DocumentRef) Fetch

func (dr *DocumentRef) Fetch(id string) *DocumentFetchRequest

Fetch returns the document fetch request.

func (*DocumentRef) FetchMeta

func (dr *DocumentRef) FetchMeta(id string) *DocumentFetchMetaRequest

FetchMeta returns the document fetch meta request.

func (*DocumentRef) Update

func (dr *DocumentRef) Update(id string, document Document) *DocumentUpdateRequest

Update returns the document update request.

type DocumentUpdateRequest

type DocumentUpdateRequest struct {
	// contains filtered or unexported fields
}

DocumentUpdateRequest defines the document create request.

func (*DocumentUpdateRequest) Do

Do performs the request.

func (*DocumentUpdateRequest) WithContext

WithContext adds a context to the request.

func (*DocumentUpdateRequest) WithRevision

func (dur *DocumentUpdateRequest) WithRevision(revision string) *DocumentUpdateRequest

WithRevision adds a revision to the request.

type DocumentUpdateResponse

type DocumentUpdateResponse struct {
	OK       bool   `json:"ok"`
	ID       string `json:"id"`
	Revision string `json:"rev"`
}

DocumentUpdateResponse defines the document create response.

Jump to

Keyboard shortcuts

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