forked from github/dataease
28 lines
826 B
Plaintext
28 lines
826 B
Plaintext
querySql(groups, aggregators, filters, orders, table, isGroup)
|
|
::=<<
|
|
SELECT
|
|
<if(!groups && !aggregators)>
|
|
*
|
|
<endif>
|
|
<if(groups)>
|
|
<groups:{group|<if(group)><group.fieldName> AS <group.fieldAlias><endif>}; separator=",\n">
|
|
<endif>
|
|
<if(groups && aggregators)>,<endif>
|
|
<if(aggregators)>
|
|
<aggregators:{agg|<if(agg)><agg.fieldName> AS <agg.fieldAlias><endif>}; separator=",\n">
|
|
<endif>
|
|
FROM
|
|
<table.tableName> <table.tableAlias>
|
|
<if(filters)>
|
|
WHERE
|
|
<filters:{filter|<if(filter)><filter.whereField> <filter.whereTermAndValue><endif>}; separator="\nAND ">
|
|
<endif>
|
|
<if(isGroup && groups)>
|
|
GROUP BY
|
|
<groups:{group|<if(group)><group.fieldName><endif>}; separator=",\n">
|
|
<endif>
|
|
<if(orders)>
|
|
ORDER BY
|
|
<orders:{order|<if(order)><order.orderAlias> <order.orderDirection><endif>}; separator=",\n">
|
|
<endif>
|
|
>> |