-
Notifications
You must be signed in to change notification settings - Fork 8
FieldProp(BREAKING!): 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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #231 +/- ##
==========================================
+ Coverage 71.16% 71.29% +0.13%
==========================================
Files 81 81
Lines 10327 10332 +5
==========================================
+ Hits 7349 7366 +17
+ Misses 2411 2399 -12
Partials 567 567 ☔ 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
1e899a2
to
5670fdd
Compare
5670fdd
to
f6022cb
Compare
❗BREAKING CHANGE
If field prop
sequence
is set in map field in a table sheet (Excel/CSV), it will now be generated to scalar field key's field prop of map value, but not the map field itself.Compatibility resolution
If field prop

sequence
is set in map field in a table sheet (Excel/CSV), please regenerate its proto files for upgrading.For example: