gocouch

package module
v0.0.0-...-a924b79 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2019 License: MIT Imports: 8 Imported by: 0

README

gocouch

Yet another CouchDB client written in Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config *Config) (*Client, error)

func (*Client) CreateDatabase

func (c *Client) CreateDatabase(name string) (*Database, error)

func (*Client) GetDatabase

func (c *Client) GetDatabase(name string) (*Database, error)

func (*Client) ListDatabases

func (c *Client) ListDatabases() ([]string, error)

type Config

type Config struct {
	Cookies   []*http.Cookie `json:"cookies"`
	Host      string         `json:"host"`
	Port      int            `json:"port"`
	Username  string         `json:"username"`
	Password  string         `json:"password"`
	TimeoutMS int            `json:"timeoutms"`
	TLS       bool           `json:"tls"`
}

Config ...

func (*Config) IsValid

func (cfg *Config) IsValid() bool

func (*Config) String

func (cfg *Config) String() string

type Database

type Database struct {
	Name string
	// contains filtered or unexported fields
}

func (*Database) CreateDesignDoc

func (db *Database) CreateDesignDoc(name, path string) (*DocResponse, error)

func (*Database) CreateDoc

func (db *Database) CreateDoc(name string, data []byte) (*DocResponse, error)

func (*Database) DeleteDoc

func (db *Database) DeleteDoc(name, revision string) (*DocResponse, error)

func (*Database) GetAllDoc

func (db *Database) GetAllDoc(includeContent bool) (*ViewResponse, error)

func (*Database) GetDoc

func (db *Database) GetDoc(name string) ([]byte, error)

type DocResponse

type DocResponse struct {
	ID  string `json:"id"`
	Ok  bool   `json:"ok"`
	Rev string `json:"rev"`
}

type Row

type Row struct {
	ID    string `json:"id"`
	Key   string `json:"key"`
	Value struct {
		Rev string `json:"rev"`
	} `json:"value"`
	Doc []byte `json:"doc"`
}

type ViewResponse

type ViewResponse struct {
	Offset int    `json:"offset"`
	Rows   []*Row `json:"rows"`
	Total  int    `json:"total_rows"`
}

Jump to

Keyboard shortcuts

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