nodebatis
Version:
a sql style orm for nodejs
40 lines (33 loc) • 632 B
YAML
namespace: 'test'
attrs: id, name, age
conds:
- if:
test: :age > 18
sql: and age = :age
- if:
test: name
sql: and name = :name
query:
- select {{ test.attrs }} from test
- where {{test.conds}}
whereUnionTest:
- select * from test where {{test.conds}}
- union all
- select * from test where
- if:
test: :name
sql: and name = :name
forTest:
- select * from test where
- id in (
- for:
array: :ids
sql: :id
seperator: ','
- )
batchInsert:
- insert into test(name, age) values
- for:
array: data
sql: (:name, :age)
seperator: ','