Skip to content

Generating queries into multiple packages with the same schema. #314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mightyguava opened this issue Jan 31, 2020 · 2 comments
Closed

Generating queries into multiple packages with the same schema. #314

mightyguava opened this issue Jan 31, 2020 · 2 comments
Labels
future In the year 3000...

Comments

@mightyguava
Copy link
Contributor

Should sqlc support separating packages for the query and schema structs, for when the number of queries grow? In the context of the ondeck example, maybe the user will want to have generated queries for Venue and City in separate packages, plus another package for queries that use both, plus a package for the generated schemas. This is contrived, but imagine there are dozens of tables, and at least a quadratic number of relations. At that point it would be useful to separate some queries into its own packages.

sqlc at the moment supports multiple packages, but does not support sharing schema across packages without duplicating the generated schema structs.

@kyleconroy
Copy link
Collaborator

I agree that this will become a problem for larger project. However, I'd like to pass on implementing a solution for now. It complicates the code generation quite a bit, and I don't think it's worth the effort right now.

As our users' applications grow and larger users adopt sqlc, we can revisit this.

@mightyguava
Copy link
Contributor Author

My side project that I started using sqlc on already has 39 queries, and it already feels kind of excessive to keep in the same package. Too many methods on the Queries struct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future In the year 3000...
Projects
None yet
Development

No branches or pull requests

2 participants