Skip to content
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

Disable adding JSON sample to go files #194

Open
jpmeijers opened this issue Mar 5, 2024 · 1 comment
Open

Disable adding JSON sample to go files #194

jpmeijers opened this issue Mar 5, 2024 · 1 comment

Comments

@jpmeijers
Copy link

Currently every generated file has comments at the top, which includes a description of the database table and fields, followed by a json sample of the data. This json sample changes every time gen is run. This means git detects file changes in all the generated files.

It would be great if this json sample does not change when gen is run again. Or maybe we could just exclude this json sample from the comments.

Example:

/*
DB Table Details
-------------------------------------


Table: billing_backend_usertenant
[ 0] id                                             INT8                 null: false  primary: true   isArray: false  auto: true   col: INT8            len: -1      default: []
[ 1] tenant_id                                      INT8                 null: false  primary: false  isArray: false  auto: false  col: INT8            len: -1      default: []
[ 2] user_id                                        INT4                 null: false  primary: false  isArray: false  auto: false  col: INT4            len: -1      default: []


JSON Sample
-------------------------------------
{    "id": 52,    "tenant_id": 19,    "user_id": 76}



*/

changes to the following when gen was run again

/*
DB Table Details
-------------------------------------


Table: billing_backend_usertenant
[ 0] id                                             INT8                 null: false  primary: true   isArray: false  auto: true   col: INT8            len: -1      default: []
[ 1] tenant_id                                      INT8                 null: false  primary: false  isArray: false  auto: false  col: INT8            len: -1      default: []
[ 2] user_id                                        INT4                 null: false  primary: false  isArray: false  auto: false  col: INT4            len: -1      default: []


JSON Sample
-------------------------------------
{    "id": 77,    "tenant_id": 87,    "user_id": 69}



*/
@Morpheus0x
Copy link

Yes, I strongly support this. If the underlying SQL doesn't change, no change should be visible in the file when overwriting existing generated go files. This JSON Sample is present, even when the flag --no-json is used, which seems especially useless. When using git, ignoring or reverting these changes becomes annoying quickly and may potentially lead to ignoring actual changes. And committing those changes doesn't make sense, since nothing actually changed.

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

No branches or pull requests

2 participants