Skip to content

Instantly share code, notes, and snippets.

@blinkov
Created November 12, 2012 20:49
Show Gist options
  • Save blinkov/4061784 to your computer and use it in GitHub Desktop.
Save blinkov/4061784 to your computer and use it in GitHub Desktop.
Erlang Multiget Example
-module(riak).
-author("Ivan Blinkov <[email protected]>").
-export([multiget/3]).
multiget(Pid, Bucket, Keys) ->
case riakc_pb_socket:mapred(Pid,
[{Bucket, Key} || Key <- Keys],
[
{reduce,
{modfun, riak_kv_mapreduce, reduce_set_union}, none, false},
{map,
{modfun, riak_kv_mapreduce, map_identity}, none, true}
]) of
{ok,[{_,List}|_]} ->
{ok,
[new(Bucket, Key, Value) ||
{r_object, _Bucket, Key,
[{r_content, _Meta, Value}],
_VClock, _UpdateMeta, _UpdateVal} <- List]};
{error,notfound} ->
[];
Other ->
Other
end.
@tuafeeqahmed
Copy link

Can you write "money denomination" code in erlang Language ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment