-
Notifications
You must be signed in to change notification settings - Fork 2
Add versionedjob contrib package with basic versioning framework
#39
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
base: master
Are you sure you want to change the base?
Conversation
83512d6 to
be6ba5e
Compare
diegobernardes
left a comment
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.
🚀
be6ba5e to
13d81f2
Compare
Here, add a contrib package called `versionedjob` that brings in a very basic job versioning framework. The framework is very lightweight and users could easily have written it themselves, but it might be a little non-obvious how to leverage hooks to bring it in. Contrib should be a really nice home for this feature because it's a little too trivial to bother with in core, but it's nice for people to have a semi-official reference that's well-maintained.
13d81f2 to
aab9fad
Compare
|
Nice. @bgentry Want to take a look at this too? Might make a good blog post at least. |
bgentry
left a comment
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 like one good way to do this! Another is to implement a custom UnmarshalJSON on your arg type.
| } | ||
| ``` | ||
|
|
||
| The `VersionTransformer` implementation handles version upgrades one by one. Jobs which are multiple versions old can still be upgraded because multiple version changes can be applied in one go. This implementation uses `gjson`/`sjson` so that each change need only know a minimum about the data object in question and that unknown fields are retained. Other approaches are possible though, including using only Go's built-in `gjson` package. |
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.
I assume you meant encoding/json?
| The `VersionTransformer` implementation handles version upgrades one by one. Jobs which are multiple versions old can still be upgraded because multiple version changes can be applied in one go. This implementation uses `gjson`/`sjson` so that each change need only know a minimum about the data object in question and that unknown fields are retained. Other approaches are possible though, including using only Go's built-in `gjson` package. | |
| The `VersionTransformer` implementation handles version upgrades one by one. Jobs which are multiple versions old can still be upgraded because multiple version changes can be applied in one go. This implementation uses `gjson`/`sjson` so that each change need only know a minimum about the data object in question and that unknown fields are retained. Other approaches are possible though, including using only Go's built-in `encoding/json` package. |
Here, add a contrib package called
versionedjobthat brings in a verybasic job versioning framework. The framework is very lightweight and
users could easily have written it themselves, but it might be a little
non-obvious how to leverage hooks to bring it in.
Contrib should be a really nice home for this feature because it's a
little too trivial to bother with in core, but it's nice for people to
have a semi-official reference that's well-maintained.