Description
Hi! I'm working on sqld, a code generator that takes SQL queries and outputs type-safe Go code using pgx. I'm a big fan of sqlc (hence the name) and if you have some time, I'd love to get your thoughts on the RFC, specifically:
-
Is it possible or beneficial to merge the approaches used in sqlc and sqld? I created a new project because one of sqlc's value propositions is that it must work without running Postgres. For sqld, I wanted to avoid implementing parsing logic by leaning more heavily on Postgres. Additionally, I'd prefer to only support pgx instead of the
sql
package. -
Are you okay with the name
sqld
? I thought it was mildly clever but I'm open to changing it. -
Possible collaboration on a future ClientTrace API similar to the Go stdlib http tracing: https://blog.golang.org/http-tracing. There's a ton of useful metrics to surface (DNS resolution for host names, response parse time, pool queue time). I've created an initial pgx-focused ClientTrace.go that I use in the generated code.
-
Overall API design.
- Is it worth supporting options when building a Querier?
- How many inline parameters before switching to a struct:
FindAuthors(ctx, "name")
vsFindAuthors(ctx, FindAuthorsParams{Name: "name"})
. Looks like sqlc switches after 1 parameter.
RFC: sqld: Go code generation for Postgres (Google doc)
To summarize the main differences between sqld and sqlc:
- sqld requires a running Postgres instance to get type information by executing queries.
- sqld only supports pgx.
I've started a similar discussion on the pgx repo: jackc/pgx#915. Feel free to close this whenever.