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
Support embeddable structs #262
Conversation
Thank you, this looking great 👍 A few things to improve, can you add:
|
Codecov Report
@@ Coverage Diff @@
## master #262 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 47 47
Lines 3092 3135 +43
=========================================
+ Hits 3092 3135 +43
Continue to review full report at Codecov.
|
I've added support for name prefixes and updated the description.
This is now checked. I've also added some more tests.
|
Agreed 👍 |
I've moved embedded pointer initialization to document creation. This is a more "eager" approach, but traversing reflect Values and checking nils for field reads is somewhat costly |
hmm, not sure about the correctness of this behavior. |
So all field reads/writes should be wrapped with pointer checks? Not a problem, I just thought it's somewhat costly. We could |
yes right, but it's for the correctness, unless there's better way to implement it 🤔 |
after giving it some thought and re-reading existing implementation, I think reads shouldn't initialize pointer |
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.
Thank you!!
just some more small comments, but overall already looking good 🎉
Thanks for your contribution ❤️ |
No problem, I'll have a look at it soon |
Hi! I've added support for embedded structs as discussed in this issue.
Both pointers and plain fields are supported.
By default embedded field names are added without prefixes. Name prefixes can be set like for other fields:
If two fields have the same name, REL panics during construction:
What I've changed
documentData
indices now store full field paths as []intdocumentData
s are merged for embedded fields during creationTests
I've added tests for all main cases