6 ms·
When using raw SQL in strings, I really miss the automatic formatting that is provided for HTML, TSX and TS with prettier. Raw SQL query strings also do not co
by timmy-turner 6y ago
When using raw SQL in strings, I really miss the automatic formatting that is provided for HTML, TSX and TS with prettier.
Raw SQL query strings also do not compose well and I miss auto completion when writing them (yes, I'm a spoiled kid after so much Typescript usage).
As with everybody else, I didn't like existing ORM/builder approaches, so I built and use my own with type-inference: https://github.com/hoeck/typesafe-query-builder https://github.com/hoeck/typesafe-query-builder.
Any feedback would be great because I have the gut feeling that this one has gone way too far on the type astronaut side of things.
- hv42 6y agoYou should be able to do this with IntelliJ e.g. where you can inject a language into a string. This is quite handy as you can reformat and open the string in a separate editor if needed. The caveat is that it does not work well if you are composing the SQL queries from multiple small parts. see https://www.jetbrains.com/help/idea/running-injected-sql-statements.html https://www.jetbrains.com/help/idea/running-injected-sql-sta... I suppose that other editors or IDE can do similar things.