3 ms·
Typesafe SQL, typesafe template (or just useful template, not the ones in the stdlib which sucks tremendously), model metaprogramming, etc...
by maattdd 5y ago
Typesafe SQL, typesafe template (or just useful template, not the ones in the stdlib which sucks tremendously), model metaprogramming, etc...
- alecthomas 5y agoFWIW for SQL, sqlc[1] is probably the nicest SQL layer I've used in any language. [1] https://github.com/kyleconroy/sqlc https://github.com/kyleconroy/sqlc
- rawoke083600 5y agoReally, really wanted to use it a few days ago.. but not sure if it's a mysql8 issue but seems most of my "very simple" table definitions couldn't be parsed :/ Looking at the github there seems to a lot of "parsing problems" for the schema files :(
- Cthulhu_ 5y agoDo you have any examples of other languages offering typesafe SQL integrations? Not sure what to think of it, given how you'd end up having to map SQL datatypes (across multiple database engines) with Go's own (not very powerful) types or a custom type validation layer (which already moves the problem to runtime instead of compile-time). I did see a post the other day criticizing Go's standard template language and approach. Maybe someday someone will stand up and build an alternative, more advanced template engine - it can just be a library, after all.
- maattdd 5y agoIn Rust: https://github.com/launchbadge/sqlx https://github.com/launchbadge/sqlx In Haskell: https://hackage.haskell.org/package/esqueleto https://hackage.haskell.org/package/esqueleto Either it analyzes the given SQL to determine the in/out types of each SQL query, or it calls the database describe feature at compile-time.