Skip to content

Conversation

@alessiodionisi
Copy link
Contributor

This PR adds the possibility to customize the output file names, by default everything remains as before so it's transparent for all users.

Example configuration:

version: "1"
packages:
  - name: db
    path: internal/db
    queries: internal/db
    schema: migrations
    engine: postgresql
    emit_prepared_queries: true
    emit_interface: false
    output_db_file_name: db_gen.go
    output_models_file_name: model_gen.go
    output_querier_file_name: querier_gen.go
    output_files_suffix: _gen.go

@kyleconroy kyleconroy self-requested a review May 3, 2021 21:58
Copy link
Collaborator

@kyleconroy kyleconroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change! Can you please add a test in the testdata directory that uses your new configuration options?

@alessiodionisi alessiodionisi requested a review from kyleconroy May 3, 2021 22:39
Copy link
Collaborator

@kyleconroy kyleconroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding tests

@alessiodionisi
Copy link
Contributor Author

If I find time in the next week I would also like to add a few lines in the docs about the new options 😄

@kyleconroy kyleconroy merged commit 77db7d1 into sqlc-dev:main May 4, 2021
victoraugustolls pushed a commit to Streppel/sqlc that referenced this pull request May 6, 2021
* customizable output file names

* fix tests

* use OutputFilesSuffix only on queryFile template, add tests
@alessiodionisi alessiodionisi deleted the custom-output branch May 26, 2021 18:18
kyleconroy pushed a commit that referenced this pull request Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants