-
Notifications
You must be signed in to change notification settings - Fork 8
confgen(FieldProp): support sequence in auto-merge map keys, keyed list keys, and normal fields #231
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
Kybxd
commented
Apr 24, 2025
•
edited
Loading
edited
- close FieldProp(sequence ): support sequence check even when parent same-key auto merge #163
- close FieldProp(sequence): extend sequence ability for normal integer field #162
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #231 +/- ##
==========================================
+ Coverage 71.00% 71.13% +0.13%
==========================================
Files 80 80
Lines 10184 10189 +5
==========================================
+ Hits 7231 7248 +17
+ Misses 2388 2376 -12
Partials 565 565 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a2966d4
to
a4b0c43
Compare
internal/confgen/parser.go
Outdated
func (sp *sheetParser) checkListKeyUnique(field *Field, reflectList protoreflect.List, keyData string) error { | ||
// TODO: we need to cache key field descriptor for reuse, to avoid each loop to find it when parse table rows or document nodes. | ||
md := reflectList.NewElement().Message().Descriptor() |
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.
For higher performance, we'd better NOT create new element for getting MessageDescriptor, it is costy. Just use the provided parameter md
?
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.
done
internal/confgen/parser.go
Outdated
} | ||
seq := keyField.opts.Prop.GetSequence() | ||
len := int64(reflectMap.Len()) | ||
val, err := strconv.ParseInt(keyData, 10, 64) |
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.
- Too many same code lines in the two func:
checkMapKeySequence
andcheckListKeySequence
, please encaplulate the same code lines to one func. strconv.ParseInt(keyData, 10, 64)
only supportint64
, but will not supportuint64
when its value is out-bound-ofint64
.
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.
- done
- no need to support since values > max int64 is hardly used.
tableau.proto
also declares sequence as int64
0ac88bc
to
1e899a2
Compare
1e899a2
to
5670fdd
Compare