-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add Patch Functionality and Defined Fields to picard metadata #6
Conversation
@mrhwick I'm thinking I'll write a few more tests for this and clean things up a bit, but I wanted to let you check this out and see if you like the direction. |
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 looks good
picard.go
Outdated
@@ -41,7 +43,9 @@ type DBChange struct { | |||
// Used as an embedded type on a model struct, and certain metadata can be added as struct tags. | |||
// Currently supported tags: | |||
// tablename | |||
type StructMetadata bool | |||
type StructMetadata struct { |
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 might want to take the opportunity to rename this type to something like ModelMetadata
since it is storing information about model schema in tags, and dynamically storing different information for internal handling of an instance of a model at run-time.
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.
What do you think about just calling it "Metadata"
picard.go
Outdated
@@ -41,7 +43,9 @@ type DBChange struct { | |||
// Used as an embedded type on a model struct, and certain metadata can be added as struct tags. | |||
// Currently supported tags: | |||
// tablename | |||
type StructMetadata bool | |||
type StructMetadata struct { | |||
DefinedFields []string |
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.
Is there a use-case where this needs to be exported? If picard is the only thing stowing information here, then we don't necessarily need to export this field.
Adds Unmarshalling functionality to Picard. If you unmarshal through picard, any undefined fields will be added to picard StructMetadata.
Picard model updates will now read from model metadata to determine if only a partial update was requested.