Description
What do you want to change?
Question:
Hi, I’m using sqlc
in my project, and I have a modular service structure like this:
service/
├── auth/
├── customers/
├── products/
├── orders/
Each service has its own queries.sql
file, and I would like the generated Go files (e.g., auth.sql.go
, customers.sql.go
, etc.) to be placed in their respective directories with the correct package name.
Currently, I need to create separate blocks in the sqlc.yml
file for each service manually, like this:
- engine: "postgresql"
schema: "./cmd/migrate/migrations/schema.sql"
queries: "./service/auth/queries.sql"
gen:
go:
package: auth
out: "./service/auth"
This works, but it can get repetitive as the number of services grows.
My question is:
Does sqlc
plan to support a way to automatically detect and generate code for multiple directories and packages based on the queries.sql
file location? For example, if queries.sql
is in service/customers/
, the generated code would automatically go to service/customers/
with the customers
package name.
If not, is this something that could be considered for future releases?
What database engines need to be changed?
No response
What programming language backends need to be changed?
No response