-
Notifications
You must be signed in to change notification settings - Fork 0
feat(fields): read/set all the fields from the given struct #10
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
Conversation
Reviewer's Guide by SourceryThis pull request implements a new feature for reading and setting all fields from a given struct. It introduces a new package called 'fields' with functionality to iterate over struct fields, set and get their values, and handle various edge cases. The changes also include extensive testing and examples to demonstrate the new functionality. Class diagram for the new 'fields' packageclassDiagram
class fields {
+Iterate(any, ...Option) error
+PrefillNilStructs(bool) Option
+Setter(func(Path, any) (any, bool)) Option
+Getter(func(Path, any)) Option
+ConvertTypes(bool) Option
+ConvertToPointers(bool) Option
+Recursive(bool) Option
}
class config {
+setter func(Path, any) (any, bool)
+getter func(Path, any)
+prefillNilStructs bool
+convertTypes bool
+convertToPtr bool
+recursive bool
}
class Path {
+Names() []string
+HasSuffix(...string) bool
+EqualNames(...string) bool
}
fields --> config
fields --> Path
class intReflect {
+IterateFields(any, FieldCallback, bool, bool) error
}
fields --> intReflect
class FieldCallback {
+func(reflect.StructField, any) (any, bool)
}
intReflect --> FieldCallback
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @bkrukowski - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Pull Request Test Coverage Report for Build 11134023798Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 11133578842Details
💛 - Coveralls |
`make addlicense`
|


Summary by Sourcery
Implement a new feature to iterate over struct fields, enabling setting and getting values through callbacks. Refactor existing code to support this functionality and add extensive tests and examples to validate the new feature.
New Features:
Enhancements:
Build:
Tests: