erlang driver for rethinkdb
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.gitignore
.travis.yml
LICENSE
Makefile
README.md
cover.spec
rebar
rebar.config
rebar.tests.config

README.md

Lethink

An erlang driver for rethinkdb.

Status

Build Status

Use

> lethink:start().
> application:set_env(lethink, timeout, 60000).
> lethink:add_pool(my_db_pool, 5, [{database, "localhost"}, {port, 28015}]).
> lethink:query(my_db_pool, [{db_create, <<"superheroes">>}]).
> lethink:query(my_db_pool, [{db_list}]).
> lethink:query(my_db_pool, [{db_drop, <<"superheroes">>}]).
> lethink:query(my_db_pool, [{db, <<"superheroes">>}, {table_create, <<"marvel">>}]).
> lethink:query(my_db_pool, [{db, <<"superheroes">>},
                             {table_create, <<"marvel">>, [{primary_key, <<"name">>}]}]).
> lethink:query(my_db_pool, [{db, <<"superheroes">>}, {table_list}]).
> lethink:query(my_db_pool, [{db, <<"superheroes">>}, {table_drop, <<"marvel">>}]).
> lethink:use(my_db_pool, <<"superheroes">>).
> JsonProplist = [{[{<<"id">>, 5}, {<<"name">>, <<"batman">>}, {<<"rich">>, true}, {<<"cars">>, [1,2,3]}]},
                  {[{<<"id">>, 6}, {<<"name">>, <<"robin">>}, {<<"rich">>, false}, {<<"cars">>, null}]}].
> lethink:query(my_db_pool, [{table, <<"marvel">>},
                           {insert, JsonProplist}].
> lethink:query(my_db_pool, [{table, <<"marvel">>}, {get, 5}]).