feat(fields): read/set all the fields from the given struct#10
Closed
bkrukowski wants to merge 12 commits intomainfrom
Closed
feat(fields): read/set all the fields from the given struct#10bkrukowski wants to merge 12 commits intomainfrom
bkrukowski wants to merge 12 commits intomainfrom
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.
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`
|
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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: