Skip to content

Added whitelist flags for generate command #506

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

Merged
merged 5 commits into from
Jun 26, 2025
Merged

Conversation

Sanjaiy
Copy link
Contributor

@Sanjaiy Sanjaiy commented Jun 18, 2025

Added whitelist flags for generate command. Related to issue.
Flags
-allow-tables
Comma-separated list of tables to allow. Takes precedence over --ignore-tables flag.
-allow-views
Comma-separated list of views to allow. Takes precedence over --ignore-views flag.
-allow-enums
Comma-separated list of enums to allow. Takes precedence over --ignore-enums flag.

Copy link

codecov bot commented Jun 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.32%. Comparing base (be59a88) to head (b0636c2).
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #506   +/-   ##
=======================================
  Coverage   91.32%   91.32%           
=======================================
  Files         136      136           
  Lines        8307     8307           
=======================================
  Hits         7586     7586           
  Misses        545      545           
  Partials      176      176           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cmd/jet/main.go Outdated

flag.StringVar(&allowTables, "allow-tables", "", `Comma-separated list of tables to allow. Takes precedence over --ignore-tables flag.`)
flag.StringVar(&allowViews, "allow-views", "", `Comma-separated list of views to allow. Takes precedence over --ignore-views flag.`)
flag.StringVar(&allowEnums, "allow-enums", "", `Comma-separated list of enums to allow. Takes precedence over --ignore-enums flag.`)
Copy link
Owner

@go-jet go-jet Jun 22, 2025

Choose a reason for hiding this comment

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

Not sure about allow word in the name. Maybe just -tables, -views and -enums.

Copy link
Owner

Choose a reason for hiding this comment

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

Also, if the user uses both options (-tables and -ignore-tables), it would be best to return an error rather than silently choose one option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@go-jet Done the changes.

cmd/jet/main.go Outdated

flag.StringVar(&allowTables, "tables", "", `Comma-separated list of tables to allow.`)
flag.StringVar(&allowViews, "views", "", `Comma-separated list of views to allow.`)
flag.StringVar(&allowEnums, "enums", "", `Comma-separated list of enums to allow.`)
Copy link
Owner

Choose a reason for hiding this comment

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

Comma-separated list of tables to generate. , ....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@go-jet Updated the description as suggested.

cmd/jet/main.go Outdated

allowTables string
allowViews string
allowEnums string
Copy link
Owner

Choose a reason for hiding this comment

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

Could you also drop allow from this variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@go-jet Done. Dropped 'allow' from the variables.

cmd/jet/main.go Outdated
)

type templateFilter struct {
names []string
allow bool
Copy link
Owner

Choose a reason for hiding this comment

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

This allow as well, feels slightly misleading. Inverting the logic should be more clear - ignore bool.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@go-jet Makes sense. Refactored the logic to use ignore bool.

@go-jet
Copy link
Owner

go-jet commented Jun 26, 2025

Thanks. Looks good. 👍

@go-jet go-jet merged commit feddefc into go-jet:master Jun 26, 2025
7 checks passed
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