Not sure if this has been asked before - given a map, how does one go about
retrieving the key of the map?

For example, in Riak example for map
<http://docs.basho.com/riak/kv/2.0.0/developing/data-types/#maps>, a map is
created with "ahmed_info" key.

If we were to write a commit hook in Erlang where we want to do some kind
of action based on the key, it will be helpful to have a way to extract the
key.

I looked in basho erlang client documentation here for map, but don't see
any function to extract the key. Perhaps we have to do pattern match to
extract the key?
http://basho.github.io/riak-erlang-client/riakc_map.html

I also see erlang libraries under riak installation (one of them
"riak_object" is called in "commit hook" example in documentation) - I can
check there as well if there is online documentation somewhere for them.

I am thinking of storing user info as immutable maps, something like
<username>_<info>_<timestamp>, and have an erlang commit hook that updates
<username>_<info>_<latest> map with the latest entry. For that, we need to
extract the map key.
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to