-
Notifications
You must be signed in to change notification settings - Fork 230
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
decode with inline pointers #217
Conversation
Thanks for the PR! Looking good so far. Regarding the initialised Again, thanks very much for take this on! Dom |
ok, right, thanks for note. |
Fix is pushed. nil-respecting behavior is available through the respect-nil option. Right before pushing I've found one more case, that should be handled. It's commented in tests. WIll handle it soon. |
bson/bson_test.go
Outdated
|
||
c.Assert(dataBSON, DeepEquals, cs.Out) | ||
// mixing empty & nil | ||
// @TODO |
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.
Is this just a forgotten test?
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.
Hm, I think it was a real TODO, not just forgotten test.
I had really turbulent few of weeks too, so I think I need to spend couple hours on this yet.
Let me look into it this weekend and then I'll push / or post here the update status
Really sorry for the delay - it's been a really, really turbulent few of weeks! I'll review over lunch today. Dom |
Looks great - just the commented test and it's good to go! |
I've debugged the issue: It's expected behaviour in the failing test, as Removing |
Thanks @larrycinnabar! It's really appreciated :) Dom |
Thanks a lot for your contribution @larrycinnabar and sorry for the delay! |
@eminano thanks for the merge into dev branch! any plans for release? |
Hi @msolimans, we'll be cutting a release soon, just need to get a bit of time to run all the performance tests required and we're set! Esther |
fix #210
My last PR !146 added ability to encode bson with inline pointers to structs (as
json.Marshal
does)Here, we add the ability to decode.
It's a little bit tricky.
help and/or review is appreciated.
only exported inline fields are allowed to be decoded. (as
field.CanInterface()
will return false for protected inline fields)Here couple of tests still needed - to check if proper error message is shown to user (that unexported inline pointers are not allowed)
there are 2 reflect helper created (to create a deep zero element) - that will be the base element when decoded. These functions need to be unit-test covered too.
Current behaviour might seem not correct. What do you think, is it ok?
This test passes. But after
Unmarshal
we getout
to be:InlinePtrStruct{A: 4, MStruct: &Mstruct{M:0}}
. So instead ofnil
inline structs we get pointers to empty structs. So, inline is always goes deep, and keeps pointers to empty structs.