lua orm lib for database schema, can use like a ordinary lua table
-
lua5.3.0
- new metamethod __oldindex to hook table set when key already existed
- need a code patch, you can see detail in this commit
-
lua5.3.2
- new function enable_oldindex(table, boolean) to enable table's __oldindex feature(default not enable)
- new metamethod __oldindex to hook hook table set when key already existed(in lua code)
- need a code patch, you can see detail in this commit
-
lpeg for schema parser
- basic data type: boolean, integer, string, struct, list, map
- custom define class
- class ref
struct
class_a {
a integer
b integer
c boolean
d string
}
list
class_b [integer]
map
class_c <integer, string>
class ref
class_d {
a class_a
b class_b
c class_c
}
complex
class_e {
a {
b [integer]
}
b [class_c]
c <string, class_c>
d {
a integer
b string
c {
a integer
b [string]
c <string, integer>
}
}
}
local orm = require 'orm'
local type_list = (require 'typedef').parse('test.td', ".")
orm.init(type_list)
local obj_a = orm.create('class_a')
you need make lua first and can see more examples in test.lua.
if you want create your own typedef syntax, you can see typedef.lua.