Skip to content
Elixir client for CouchDB
Elixir
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows
config
integration
lib
test
.formatter.exs
.gitignore
LICENSE
README.md
docker-compose.yml
mix.exs
mix.lock

README.md

ExCouch

version build status license

A pure Elixir client for CouchDB 2.

Installation

Add ex_couch to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_couch, "~> 0.1.0"}
  ]
end

Quick start

The ExCouch module can be supervised. Start it as part of your application. The url parameter is required, and should point to the base URL of your CouchDB instance (e.g. http://localhost:5984). username and password are optional for unauthenticated servers.

defmodule MyApplication do
  use Application
  def start(_type, _args) do
    children = [
      {ExCouch, url: "http://localhost:5984", username: "couch", password: "couch"}
    ]
    
    opts = [strategy: :one_for_one, name: Enseada.Supervisor]
    Supervisor.start_link(children, opts)
  end
end

After being started, methods can be called to interact with the server.

list = ExCouch.list_databases(limit: 10, skip: 5)

{:ok, "mydb"} = ExCouch.create_database("mydb")

if ExCouch.database_exists?("mydb") do
  {:ok, info} = ExCouch.get_database("mydb")
end

Documentation

Documentation can be found at https://hexdocs.pm/ex_couch.

You can’t perform that action at this time.