News for hackers. Stuff that matters.
Re:How We Went All In on sqlc/pgx for Postgres and Go by sk0g on Wednesday September 08, 2021 @08:26PM (#28464730)
JetBrains IDEs help with this actually.

When I was working with Go, all SQL longer than one or two lines went into the package level sql.go file, each query being a multi-line string. If you preface it with a comment like `// language=PostgreSQL`, you get syntax highlighting for PGSQL. What's more, if you have databases configured in your IDE, it tries to cross-reference the tables, columns, etc, and validates the queries for you.

I never did manage to get the latter part working 100%, but I think it's because we used multiple top-level databases, but in the DB setup we had just one connection, that we then switched around to look at things.

Re:How We Went All In on sqlc/pgx for Postgres and Go by earthboundkid on Wednesday September 08, 2021 @10:52PM (#28465672)
With Go 1.16, you can embed SQL files into your Go app instead of using a multiline literal.

I actually am curious if a SQLC competitor should be written using embed + generics once generics drop in 1.18. I haven’t totally worked on what it would look like yet, but it’s an interesting idea.

Re:How We Went All In on sqlc/pgx for Postgres and Go by Sadzeih on Thursday September 09, 2021 @04:44AM (#28467620)
I think generics will change a lot of the ORM space for go yeah. Will be interesting to see.