Control where individual generated files go? #3384
-
Hello everyone, just wandering if something like this is possible, I have the following
I would like to move each of the *.sql file into a specific directory and output package, so the user would go into Using golang, is there a way currently to achieve this? My current config version: "2"
sql:
- engine: "postgresql"
queries: "db/queries"
schema:
- "db/schemas"
database:
uri: postgres//postgres:postgres@postgres:5432/seolitic
gen:
go:
package: "db"
out: "internal/db" |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, try something like this. version: "2"
sql:
- name: usersql
engine: "postgresql"
queries: "db/queries/user.sql"
schema: - "db/schemas"
database: uri: postgres//postgres:postgres@postgres:5432/seolitic
gen:
go:
package: "userdb"
out: "internal/db/user"
- name: paymentsql
engine: "postgresql"
queries: "db/queries/payment.sql"
schema: - "db/schemas"
database: uri: postgres//postgres:postgres@postgres:5432/seolitic
gen:
go:
package: "paymentdb"
out: "internal/db/payment |
Beta Was this translation helpful? Give feedback.
-
And I use this parameter to remove unnecessary things during generation
If true, sqlc won’t generate table and enum structs that aren’t used in queries for a given package. Defaults to false. |
Beta Was this translation helpful? Give feedback.
Hi, try something like this.