A port of the popular ohm library to Lua.
-- define this in models/user.lualocalohm=require("ohm")
returnohm.model("User", {
attributes= {
"lname",
"fname",
"email"
},
indices= {
"full_name"
},
uniques= {
"email"
}
})
-- using it: (e.g. in app.lua)localuser=require("models/user")
localresp=require("resp")
localattributes= {
email="john@example.org",
fname="John",
lname="Doe",
full_name="John Doe",
}
localdb=resp.new("localhost", 6379)
localid=assert(user:save(db, attributes))
assert("1" ==id)MIT