I want to use bitwise operation like xor on the UDF, is there any way of doing that?
Lua UDF can use standard luajit bitops library
Checkout API Functions for more ops
Example File: bittest.lua
local bit = require(ābitā) function xorbitandstore (rec, binname, a, b) local c = bit.bxor(a,b) rec[binname] = c; if aerospike:exists(rec) then aerospike:update(rec) else aerospike:create(rec) end return c end
aql> register module ābittest.luaā OK, 1 module added.
aql> execute bittest.xorbitandstore(āmybinā, 3,5) on test.demo where PK=ā1ā ±---------------+ | xorbitandstore | ±---------------+ | 6 | ±---------------+ 1 row in set (0.000 secs)
aql> select * from test.demo where PK=ā1ā ±------+ | mybin | ±------+ | 6 | ±------+ 1 row in set (0.000 secs)
1 Like