2 ms·
You should be, but because a lot sql in Go is still just strings it makes it easy for someone to bypass because of laziness/sloppiness/distracted/whatever when
by matwood 7y ago
You should be, but because a lot sql in Go is still just strings it makes it easy for someone to bypass because of laziness/sloppiness/distracted/whatever when composing queries. There is also the issue that if the Go code needs to run on Postgres it has to use '$' params instead of '?'. So again, back to string concatenation to support both or use some library like squirrel[1].
[1] https://github.com/Masterminds/squirrel https://github.com/Masterminds/squirrel
- weberc2 7y agoIs it common to write apps that target multiple databases with SQL as the abstraction point? SQL behaves so differently across vendors (with respect to performance, extensions, etc) that I would be more inclined to write distinct queries for each vendor rather than try to find strings optimal for every vendor.
- kasey_junk 7y agoIt used to be much more common when we shipped software to enterprises that required particular databases. It’s much less common in SaaS environments.