Skip to content

feat(codogen): Added the ability to specify a separate package for models. #3379

New issue

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

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

Already on GitHub? # to your account

Conversation

MWT-proger
Copy link

@MWT-proger MWT-proger commented May 13, 2024

issue #835
issue #1951
issue #1941

This will allow you to create a clean project architecture.
I started using sqlc only yesterday. But I think it's a very interesting feature, and a lot of people need it.

Please tell me what needs to be fixed. I would like her to come out as soon as possible.

  • This feature has been tested with examples
  • This feature does not interfere with standard usage
  • It is necessary to add an example for this case
  • Add new options to the documentation
  • Added sorting import for generated files. Unused import are deleted, and those that are not specified are added.

MWT-proger added 10 commits May 13, 2024 12:39
…on level

using the package "golang.org/x/tools/imports "

This solves the problem in the same way as for packet separation. In the case when, for example, a package of models has been added to the interfaces, but it is not used there.

A problem was also identified due to the fact that the package was not added to the interfaces "github.com/jackc/pgx/v5/pgtype "

But the standard tool fixes these problems on its own
@MWT-proger
Copy link
Author

@kyleconroy
Hello, tell me, please, is this error not critical?
It is taken from the main repository, as I have not worked with this code.

@MWT-proger
Copy link
Author

I'm also adding the ability to put all entities in a separate package (request and response parameters). So that the storage management system is completely separated from other levels. This will allow you to test other levels separately and in no way depend on the repository.

But this is probably already in another PR, so as not to burden this PR.

@MWT-proger MWT-proger closed this Jun 27, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant