We love go-jet! We are now using it or migrating it to, in all our projects.
This is simply the best go SQL builder we have tried so far.
It is type safe thanks to the code generation and the query result mapping is very powerful.
As far as we know, this is the only solution that fully supports mapping of LEFT OUTER JOIN
out of the box.
We have used straight sql package, sqlx, squirrel
with and without sqlx
, and more recently sqlboiler.
The latter is an ORM rather than an SQL builder but we love the type safety with code generation.
Also their null types package is a breeze to work with.
But over time, sqlboiler
being an ORM, showed its limitations in terms of performance and flexibility.
Yes this is possible to revert to raw SQL but then we lose some of the type safety.
When we discovered go-jet
, we were very excited.
A type safe SQL builder solution with code generation is exactly what we were looking for!
Our only gripe was the usage of pointers for nullable values instead of the convenient null
types.
You can use different types if you provide you own custom models but we really wants to use the generated models.
After tinkering with multiple ways to generate go-jet
models with null
types, we ended up wrapping the jet code generator with a bash script
that automatically converts the types of the go-jet
models to our beloved null
types.
Here is the bash wrapper in its full glory.
Note that we are not customizing the generated code using
sed
anymore. We are using the built-in generator customization feature introduced in v.2.6.0.