Exporting models to a separate go package - Desirable?
#4196
Unanswered
matias-martini
asked this question in
Feature Requests & Ideas
Replies: 1 comment
-
|
@matias-martini I'll take another look at the existing PR and see if it's a good state. I'd love a solution that doesn't require as much configuration, but I know that this is a feature that people really want. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone! First of all, thank you for all the work that goes into sqlc. It’s an amazing project and we rely on it a lot.
I’d like to ask about a feature that has come up a few times: generating models in a separate package/module instead of everything living in one generated package.
Relevant links:
Big thanks to @berk-karaal for the work done in that PR. It made understanding the approach much easier.
Context / why this would help
In our case we have a single database schema and migrations, but several modules with their own queries and controllers. Conceptually, it looks like this:
An the proposed PR/issues would allow us to have something like this:
Having
models.goin a single place (instead of one per module/db package) would make it easier to share types across modules while keeping queries and controllers modular.My question
Before diving into code, I’d love to know what the community think:
– Is the existing PR enough, or would you prefer a different direction? Maybe extend this feature to all supported languages is required?
– Or would you prefer a fresh proposal/approach? Maybe an RFC?
I’m happy to do the work (code, tests, docs, keeping it backwards-compatible), but I don’t want to go in a direction that doesn’t fit the project.
Thanks again to all maintainers, and again to @berk-karaal for the initial implementation. Looking forward to your thoughts!
Beta Was this translation helpful? Give feedback.
All reactions