-
Notifications
You must be signed in to change notification settings - Fork 3
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
Enhance dbinfo sub-command with column names and global variables #70
Conversation
297a90c
to
f427fd6
Compare
go/cmd/dbinfo.go
Outdated
}, | ||
} | ||
|
||
cmd.Flags().StringVarP(&vtParams.Host, "host", "", "127.0.0.1", "Database host") | ||
cmd.Flags().IntVarP(&vtParams.Port, "port", "", 3306, "Database port") | ||
cmd.Flags().StringVarP(&vtParams.Uname, "user", "", "root", "Database user") | ||
cmd.Flags().StringVarP(&vtParams.Pass, "password", "", "", "Database password") | ||
cmd.Flags().StringVarP(&vtParams.DbName, "database", "", "", "Database name") | ||
cmd.Flags().StringVarP(&vtParams.DbName, "database", "", "sakila", "Database name") |
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.
we probably shouldn't use sakila as the default value, right?
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.
Removed
go/dbinfo/dbinfo.go
Outdated
Name string `json:"name"` | ||
Type string `json:"type"` | ||
KeyType string `json:"keyType,omitempty"` | ||
IsNullable bool `json:"isNullable"` |
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.
nitpick: could we slim up the json output? like removing isNullable
for false values?
go/dbinfo/dbinfo.go
Outdated
Tables []TableInfo `json:"tables"` | ||
FileType string `json:"fileType"` | ||
Tables []*TableInfo `json:"tables"` | ||
GlobalVariables *map[string]string `json:"globalVariables"` |
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.
why a reference to a map? maps are already sent around by reference, so I'm confused to why
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.
Had started with a different data structure, should have removed the reference once I used maps ... Did.
|
||
func (dbh *DBHelper) getGlobalVariables() (*map[string]string, error) { | ||
// Currently only use simple regex to match the variable names | ||
// If the variable name contains ".*" then it is treated as a regex, else exact match |
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.
seems premature to add the regex functionality, since we are not using it, or have any plans on using it at the moment
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.
removed
we should also add something to the main README about this functionality |
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
e4b292d
to
2186754
Compare
Signed-off-by: Rohit Nayak <[email protected]>
Added some information there. PTAL and modify if required. Also I have auto-wrap setup for md files, if that is not desired I can revert and only update with my changes ... |
schema
todbinfo
todos