Last active
November 2, 2019 01:22
-
-
Save rbotzer/616634ba7399fca0f5a2e2658085dd2c to your computer and use it in GitHub Desktop.
Give an award once and only once
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add an award icon to a specific player ("CFO") where awards have a type | |
# and a count, some awards can be given once, and some more than once | |
ctx = [ | |
ctxh.cdt_ctx_map_key("CFO"), | |
# the attribute map is the second element of the tuple | |
ctxh.cdt_ctx_list_index(1), | |
] | |
ops = [ | |
# give the unicorn award exactly once | |
mh.map_put( | |
"scores", "awards", {"🦄": 1}, { | |
"map_write_flags": aerospike.MAP_WRITE_FLAGS_CREATE_ONLY | |
| aerospike.MAP_WRITE_FLAGS_NO_FAIL | |
}, ctx) | |
] | |
k, m, b = client.operate(key, ops) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment