agentgt / jirm

A Java Immutable object Relational Mapper focused on simplicity, convenience, and thread safety.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL template partials

agentgt opened this issue · comments

Allow SQL template partials. The idea is that you often have a the select fields duplicated over and over again this would allow you to validate your selecting on the same fields but unfortunately require copy n' paste

SELECT from blah
-- { > stuff.sql }
blah as "stuff.blah",
foo as "fooBar"
-- { < }
where blah ....

Then stuff.sql would be from the same package or from an explicate classpath. The contents with in the comment would be validated with the contents in stuff.sql.

Also allow creating partial blocks like:

In stuff.sql :

SELECT from blah
-- {#fields}
blah as "stuff.blah",
foo as "fooBar"
-- {/fields}
where blah ....

In some other SQL file.

SELECT from blah
-- { > stuff.sql#fields }
blah as "stuff.blah",
foo as "fooBar"
-- { < }
where blah ....