-
Notifications
You must be signed in to change notification settings - Fork 0
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 functions that get max slice elements from struct tags #83
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #83 +/- ##
========================================
+ Coverage 39.1% 41.8% +2.6%
========================================
Files 5 6 +1
Lines 697 720 +23
========================================
+ Hits 273 301 +28
+ Misses 399 384 -15
- Partials 25 35 +10 ☔ View full report in Codecov by Sentry. |
tag.go
Outdated
// the struct passed as the v argument based on the 'scale' tag. It returns an error if v | ||
// is not a structure, if max is not specified for the field, the field doesn't exist or | ||
// there's a problem parsing the tag. | ||
func GetMaxElementsFromValue(v any, fieldName string) (uint32, error) { |
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.
The Get
prefix for a function/method is usually redundant and unusual for go.
func GetMaxElementsFromValue(v any, fieldName string) (uint32, error) { | |
func MaxScaleElementsForField(v any, fieldName string) (uint32, error) { |
tag.go
Outdated
return maxElements | ||
} | ||
|
||
func getMaxElements(tag reflect.StructTag) (uint32, error) { |
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.
func getMaxElements(tag reflect.StructTag) (uint32, error) { | |
func maxScaleElements(tag reflect.StructTag) (uint32, error) { |
Removed |
This adds
MustGetMaxElements
and related functions that parse struct tags to get max number of elements