/gauc.ex

Elxir Wrapper for Gauc - Rust Wrapper for Couchbase

Primary LanguageElixirMIT LicenseMIT

Gauc

Elixir Wrapper for Gauc - Rust Wrapper of Couchbase

Status

Build Status Hex version Hex.pm GitHub license

Features

  • Elixir/Erlang friendly way to access Couchbase

Prerequisites

  • elixir - dynamic, functional language designed for building scalable and maintainable applications
  • rust - systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety

Installation

If available in Hex, the package can be installed as:

  1. Add gauc to your list of dependencies in mix.exs:
def deps do
  [{:gauc, "~> x.x.x"}]
end
  1. Ensure gauc is started:
def application do
  [applications: [:gauc]]
end

hexdocs: https://hexdocs.pm/gauc

Configuration

config :gauc, Gauc,
  url: "couchbase://localhost/default",
  pool: [
    size: 2,
    max_overflow: 4
  ]

Example

This section may be outdated, see official examples instead.

Worker API

Client API

iex(1)> {:ok, handle} = Gauc.Client.connect("couchbase://localhost/default")
{:ok, {3138101329, 3409854531}}

iex(2)> {:ok, id, cas} = Gauc.Client.upsert(handle, "123", "{}")
{:ok, "123", 1507499098051444736}

iex(3)> {:ok, res} = Gauc.Client.get(handle, "123")
{:ok, "{}"}

Native API