Closed sadmansakib closed 3 years ago
Which code would you want moved? In general, having code in different locations complicates the implementation and makes pggen less predictable to use.
it would be very convenient if
type Querier interface{}
,
type DBQuerier struct {}
type genericConn interface {}
blocks and related new function as well as WithTx functions are moved to a separate go file. For example, sqlc separates them to to two different go file named {package name}.go
and querier.go
. Maybe on pggen you can move these to a separate to something like pggen.go
on the output directory. i believe this will make sql.go
files look a lot cleaner because it'll only contain query related implementations.
I understand it might look neater but it also means more generated files per directory. I've heard folks express preferences for both approaches. My preference is for 1 query file means 1 go file because it's predictable. Given that it's generated code, the less people need to think about it, the better.
I'm going to close this because:
type genericConn interface {}
but it doesn't so we included in every package. If pgx adds genericConn, I'm happy to use that instead.If you feel strongly about this, you could probably hack up an awk script to do the transformation for you.
In future release, will pggen move querier interface and all connection related code out of
*.sql.go
file? It looks kind of ugly if i have multiple.sql.go
files