Control where individual generated files go? #3384
Answered
by
MWT-proger
Nikola-Milovic
asked this question in
Q&A
|
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" |
Answered by
MWT-proger
May 16, 2024
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 |
0 replies
Answer selected by
Nikola-Milovic
|
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. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, try something like this.