-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document use of query files #2
Comments
b.t.w., when using Without it, working with large SQL files becomes awkward. Some large files may contain whole revisions commented out, plus a lot of inline documentation.
I'm not sure how this can work at all. The entire ES6 string template concept is based on evaluation of the inner expressions. Which means you cannot format any values? That is the reason I never seriously considered ES6 template strings for query formatting. See also. |
Would be helpful for setup & teardown in integration tests. Might add a dev mode flag, such that a database definition file is supplied to Slonik as configuration and if in dev mode, it sets things up before running first query. Another flag to indicate if tables need to be recreated on each run, and if not, inline a SQL procedure for resetting them. Also inline a snapshot SQL procedure that remembers current table contents. Then while playing with the app being developed one could use psql to snapshot and reset to states, and in integration tests this could be used as well. |
pg-promise
documentation features a concept of query files.This is effectively a helper function that is used to prepare a statement using
pg-promise
, e.g.In case of Slonik, this would be best implement using
sql.raw
, e.g.I don't see an immediate need to either add helper for loading queries or to advertise this as a distinct feature.
What abstraction could Slonik offer here and what value would it add?
The text was updated successfully, but these errors were encountered: