nikita-volkov / hasql-th

Template Haskell utilities for Hasql
http://hackage.haskell.org/package/hasql-th
MIT License
112 stars 8 forks source link

Support storing preparable statements in external files #6

Open nikita-volkov opened 4 years ago

nikita-volkov commented 4 years ago

Yeah would be really cool if we could keep our preparable statements in separate sql files. Definitely second this feature. P.S. Great work on this library!

Am I right in understanding that you want to store SQL of each statement in a separate file? Why do you need that?

I am having complex queries, that sometimes spawns 100s of lines, I like to have them in separate files, because of syntax highlighting and readability.

Originally posted by @popara in https://github.com/nikita-volkov/hasql-th/issues/5#issuecomment-566200045 and @charlescrain in https://github.com/nikita-volkov/hasql-th/issues/5#issuecomment-564786590

nikita-volkov commented 4 years ago

This seems to be implementable on top of "hasql-th". "hasql-th" exposes all the functionality needed for that. It should be pretty easy to implement.

Because ATM we have no evidence of this being a popular problem and likely to never get one, I likely won't be implementing that myself or merging such functionality into "hasql-th".

However this can easily be released as an extension library with the person releasing it taking on the maintenance responsibilities for that functionality. See the Benefits of being an ecosystem section of Hasql Readme for more on that.