The depth of choice of libraries and tooling on the JVM is one
compelling reason to choose Java for writing an app.
I always try to use the right tool for the job, and in doing so, I'm
impartial about the programming language.
One of the apps I've written in the last year uses both Go and Java
for different purposes, but they form one single application.
DB wise, Go has a long long way to go to catch up to Java.
The first major difference is the availability of platform native
drivers for all sorts of database products. In Java, you don't need to
search around for some OS native (read non-portable) driver that you
link to. For better or worse, you'll generally find that database
vendors provide a JDBC implementation of their own wire protocol.
Go has something similar to JDBC called database/sql, but you'll only
find a handful of implementations for this.
The second major difference IMHO is JOOQ. JOOQ for me is a reason to
stick to Java, if you have an application that uses an SQL database in
a non-trivial way.
In Go, there are a bunch of ORMs and non-ORM thingy's, which are fine
if you want to just do a bit of CRUD. Similarly, if you just want CRUD
in Java, then arguably you don't need JOOQ - there are even more ORM
and non-ORM options for Java.
What I am looking for in a database dongle is:
* A way to back propagate DDL evolution to the code base that is
accessing the DB whilst you are authoring the code.
* A mechanism to leverage SQL's ability to sort, filter, aggregate and
transform data so that you can write re-usable SQL query building
blocks and tightly factor application APIs that access the DB.
JOOQ offers the code generator in conjunction with the type safe
fluent API to provide a solution for my first requirement.
The second requirement is solved by the design of the fluent API such
that queries can be composed and nested and that although you're
hacking away in Java, you are actually thinking in SQL(*).
So why would I bother with sqlc?
Well if Lukas had never taken the time to come up with JOOQ, one might
argue that Java looses a compelling reason to be used. Chicken and
egg. I don't fully agree with the statement that in Go, lots of wheels
still need to be re-invented. I think that many already have, and have
been so with a high level of quality. But the JOOQ wheel hadn't been
re-invented for Go as yet.
In Go, you have a simple type checked language where code generation
replaces generics and OO-stuff. So it seems conceptually it leans
towards two vital ingredients of the JOOQ paradigm: code generation
and type safe API access.
(*) I'm implicitly assuming that because one uses JOOQ, one buys into
the SQL concept. If you don't like SQL, but are obliged to store your
data in a SQL database, maybe you won't feel at home with JOOQ.