ICouch v0.6.2 ICouch.DB View Source

Holds information about CouchDB databases.

Link to this section Summary

Functions

Internal function that checks if a database exists.

Initialize a DB struct.

Invokes an arbitrary CouchDB API call on a database which may or may not be implementation specific.

Invokes an arbitrary CouchDB API call on a database which may or may not be implementation specific.

Internal function to build a server endpoint.

Link to this section Types

Link to this type

t()

View Source
t() :: %ICouch.DB{name: String.t(), server: ICouch.Server.t()}

Link to this section Functions

Link to this function

exists(db)

View Source
exists(db :: t()) ::
  {:ok, t()} | {:error, ICouch.RequestError.well_known_error() | term()}

Internal function that checks if a database exists.

Link to this function

new(server, name)

View Source
new(server :: ICouch.Server.t(), name :: String.t()) :: t()

Initialize a DB struct.

Link to this function

send_raw_req(db, endpoint, method \\ :get, body \\ nil, headers \\ [], ib_options \\ [])

View Source
send_raw_req(
  db :: t(),
  endpoint :: ICouch.Server.endpoint(),
  method :: ICouch.Server.method(),
  body :: term(),
  headers :: [{binary(), binary()}],
  ib_options :: Keyword.t()
) ::
  {:ok, {response_headers :: [{binary(), binary()}], body :: binary()}}
  | {:ibrowse_req_id, id :: term()}
  | {:error, ICouch.RequestError.well_known_error() | term()}

Invokes an arbitrary CouchDB API call on a database which may or may not be implementation specific.

See ICouch.Server.send_raw_req/6.

Link to this function

send_req(db, endpoint, method \\ :get, body_term \\ nil)

View Source
send_req(
  db :: t(),
  endpoint :: ICouch.Server.endpoint(),
  method :: ICouch.Server.method(),
  body_term :: term()
) ::
  {:ok, body :: term()}
  | {:error, ICouch.RequestError.well_known_error() | term()}

Invokes an arbitrary CouchDB API call on a database which may or may not be implementation specific.

See ICouch.Server.send_req/4.

Link to this function

server_endpoint(db, endpoint)

View Source
server_endpoint(db :: t(), endpoint :: ICouch.Server.endpoint()) :: URI.t()

Internal function to build a server endpoint.

Basically prepends the database name to the given URL path segment.