Closed sadmansakib closed 3 years ago
Yep, definitely a bug. It sounds like pggen is trying to reuse the query.sql.go name for each directory A
, B
, ..., F
. The F
directory wins since it's last.
I think I'll use the following name algorithm:
query.sql
to query.sql.go
.A/query.sql
to db/A_query.sql.go
dir1/A/query.sql
to db/A_query_1.sql.go
dir2/A/query.sql
to db/A_query_2.sql.go
Is it possible to generate the query.sql.go
from the first folder than traverse other folders and append generated code to the existing query.sql.go
file?
I prefer the conceptual simplicity of 1 query file producing 1 go file. Though, it wouldn't be too hard to do it after the fact with a sed script.
pggen release: 2021-04-18
Code generation failed for following example configuration:
result :
generated 6 query files
Although pggen is generating Codes for only F query directory and entire DBQuerier and Querier interface is missing from the output directory. I am using golang migrate for maintaining database migrations so my db schema are in A.up.sql format in schema directory
update: renaming query.sql files generates all codes. it seems pggen is overwriting generated codes because of same file name