Awesome
Basic ejdb lua binding
For ejdb see Softmotions/ejdb
For documentation see https://chriku.github.io/ejdb-lua/index.html
Simple, not yet complete binding of ejdb2 for lua.
Compiles against lua5.4 and luajit
WARNING: Current xmake-based build system does not work reliably. If you want to use this I recommend compiling the single c file yourself!
Example
local ejdb = require"ejdb"
local db = assert(ejdb.open("test.db", ""))
assert(db:put("parrots", {name = "Bianca", age = 4}))
assert(db:put(8, "parrots", "{\"name\":\"Darko\", \"age\":8}"))
assert(db:exec(ejdb.query("parrots", '/[name = Darko] | apply {"age": 9}'), function() end))
local q = assert(ejdb.query("parrots", "/[age > :age]"))
q:set("age", 0, 6)
assert(db:exec(q, function(id, data)
print("id: " .. id)
for k, v in pairs(data) do
print(k, v)
end
end))
results in
id: 8
name Darko
age 9