sproto orm lib for database schema, can use like a ordinary lua table, inspired by lua-orm
-
lua5.3.2(copy from https://github.com/pigparadise/lua-orm/tree/master/lua-5.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
you can have a look at https://github.com/cloudwu/sproto
local orm = require 'orm'
local type_list = (require 'typedef').parse('test.sproto', ".")
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.