Skip to content
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

Merged
merged 5 commits into from
Jan 12, 2018

Conversation

plusplusben
Copy link
Contributor

  1. Adds Unmarshalling functionality to Picard. If you unmarshal through picard, any undefined fields will be added to picard StructMetadata.

  2. Picard model updates will now read from model metadata to determine if only a partial update was requested.

@plusplusben plusplusben self-assigned this Jan 11, 2018
@plusplusben
Copy link
Contributor Author

@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.

Copy link
Contributor

@mrhwick mrhwick left a 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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

@mrhwick mrhwick merged commit bf6b8ec into master Jan 12, 2018
@mrhwick mrhwick deleted the add-patch-functionality-to-picard branch January 12, 2018 20:00
@ghost ghost unassigned plusplusben Oct 25, 2019
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