-
Notifications
You must be signed in to change notification settings - Fork 918
mysql type overrides #281
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
mysql type overrides #281
Conversation
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.
This is looking very close to shipping. I left a few comments that should be easy to address. After this is merged, I'll work on porting most of the MySQL tests to the new end-to-end framework.
examples/booktest/mysql/models.go
Outdated
@@ -26,6 +28,7 @@ type Author struct { | |||
|
|||
type Book struct { | |||
BookID int | |||
BookUUID uuid.UUID |
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.
The booktest examples is taken from xo/xo. The PostgreSQL and MySQL versions should be the same as that project.
Can you back out your multiple changes to this file and add tests for overrides in the internal/endtoend/testdata
directory?
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.
@kyleconroy How do you think we should organize the new testdata
directory with multiple database engines?
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.
Individual tests should be in a subdirectory of testdata. Unless we're testing multi-engine configuration, we probably want to keep tests for each engine separate.
Fixes #273 .
This implements package-level and global type overrides for
mysql
usage.Implementation notes
I adjusted a few data structures to ease the passing of package settings and database schema throughout the parsing and generation process.
The primary new structures are shown below.
By separating the schema and package settings from the constructed queries, we're able to keep many of the parsing functions more functionally pure.