There was an error while loading. Please reload this page.
We are porting the documentation soon here.
1> {ok, Pid} = cowdb:open("testing.db"). {ok,<0.35.0>} 2> cowdb:put(Pid, a, 1). {ok, 1} 3> cowdb:get(Pid, a). {ok,{a,1}} 4> cowdb:mget(Pid, [a, b]). [{ok,{a,1}},not_found] 5> cowdb:put(Pid, b, 2). {ok, 2} 6> cowdb:mget(Pid, [a, b]). [{ok,{a,1}},{ok,{b,2}}] 7> cowdb:mget(Pid, [a, b, c, d]). [{ok,{a,1}},{ok,{b,2}},not_found,not_found] 8> cowdb:transact(Pid, [ {add, c, 2}, {remove, b}, {fn, fun(Db) -> {ok, {a, V}} = cowdb:get(Db, a), [{add, d, V}] end}]). {ok, 3} 9> cowdb:mget(Pid, [a, b, c, d]). [{ok,{a,1}},not_found,{ok,{c,2}},{ok,{d,1}}] 10> cowdb:fold(Pid, fun(Got, Acc) -> {ok, [Got | Acc]} end, []). {ok,[{d,1},{c,2},{a,1}]}