-
Notifications
You must be signed in to change notification settings - Fork 122
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
Added CLI Flags for Package name customization for Model, Table, View and Enum #424
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #424 +/- ##
=======================================
Coverage 91.25% 91.25%
=======================================
Files 134 134
Lines 7755 7755
=======================================
Hits 7077 7077
Misses 509 509
Partials 169 169 ☔ View full report in Codecov by Sentry. |
0582f0b
to
b08dd48
Compare
Rebased my branch with |
Issue #426 is related to how PowerShell handles arguments. However, if a quoted nested directory is passed as the value of |
Fixed path compatibility issues on Windows. |
Since we're passing a path for the model package, wouldn't it be better if the flag was Same goes for the other three as well. |
Shouldn't be |
I agree with both points that it should be I'm changing the flags like this |
cmd/jet/main.go
Outdated
@@ -170,6 +178,7 @@ func usage() { | |||
"source", "dsn", "host", "port", "user", "password", "dbname", "schema", "params", "sslmode", | |||
"path", | |||
"ignore-tables", "ignore-views", "ignore-enums", | |||
"model-pkg", "table-pkg", "view-pkg", "enum-pkg", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to update this names as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, my bad.
Pushed the changes already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. LGTM. 👍
5e2b0d2
to
71ae4ed
Compare
Goal
Jet doesn't currently support custom package names for the generated files for Models, Tables, Views, and Enums. It always uses the fixed
model
,table
,view
, andenum
names for these packages. This PR will allow users to pass OPTIONAL CLI arguments to Jet for custom package names.Features Added
Users can customize the package names through these flags,
-model-pkg
for the model package name-table-pkg
for the table package name-view-pkg
for the view package name-enum-pkg
for the enum package nameIf any or all of these flags are absent, the default package names (e.g.,
model
for Model) will be used making this a NON Breaking change.I've also added a corresponding integration test for these optional CLI arguments in Postgres. This should be sufficient as all databases use the
main.go:genTemplate()
function that was changed to accommodate this feature.For additional context, please see Issue #413