Skip to content

Instantly share code, notes, and snippets.

@z5ottu
Forked from hansonkd/riak_ops.erl
Created May 15, 2018 22:46
Show Gist options
  • Save z5ottu/875750bda2a151958fe3de2a089f9de5 to your computer and use it in GitHub Desktop.
Save z5ottu/875750bda2a151958fe3de2a089f9de5 to your computer and use it in GitHub Desktop.
% Update Counter
increment
decrement
{increment, 4}
{decrement, 9}
% Update Set
{add, <<"Value">>}
{add_all, [<<"Value">>]}
{remove, <<"Value">>}
{remove_all, <<"Value">>}
% Update Map
% Update Embedded Set
[{update, {<<"FieldName">>, riak_dt_orswot}, {add, <<"Value">>}}]
% Update Embedded Counter
[{update, {<<"FieldName">>, riak_dt_emcntr}, {increment, 1}}]
% Update Embedded Flag
[{update, {<<"FieldName">>, riak_dt_od_flag}, enable}]
% Update Embedded Register
[{update, {<<"FieldName">>, riak_dt_orswot}, {assign, <<"Val">>}]
% In a Map you can combine the updates
[
{update, {<<"Field1">>, riak_dt_od_flag}, disable},
{update, {<<"Field2">>, riak_dt_orswot}, {assign, <<"Val">>}
]
% The above operations should be put into an update statement:
{update, Operation}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment