qustavo / dotsql

A Golang library for using SQL.
GNU General Public License v2.0
741 stars 53 forks source link

Query templates #27

Closed kayrein closed 1 year ago

kayrein commented 1 year ago

Introduce support for text interpolation

qustavo commented 1 year ago

This is great, a long standing feature getting implemented! I have a look at the implementation and although it looks correct to me, I have some concerns with the public API that I'd like to share.

kayrein commented 1 year ago

In https://github.com/qustavo/dotsql/pull/27/commits/522d69598083d65df5cbd5b4a7ea28815de1ffcf I made it parse all the queries when you load them - so if you load your dotsql files at application start and have a syntax error in one of your queries it will fail at start rather than when you try to call the query. Which is pretty fast! I did add a test to assert this behaviour though.

But the WithData(...) call cannot fail because it doesn't yet know which query you're executing - it would have to try each query with that data.

Have acted on the other comments though :)

kayrein commented 1 year ago

Any thoughts @qustavo?

qustavo commented 1 year ago

@kayrein added you as a member, do you think you can cut a new release including this?