[GODRIVER-535] Add support for pointers to reflect.Kind types Created: 05/Sep/18  Updated: 04/Dec/18  Resolved: 04/Dec/18

Status: Closed
Project: Go Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: 0.1.0

Type: Improvement Priority: Major - P3
Reporter: Kristofer Brandow (Inactive) Assignee: Kristofer Brandow (Inactive)
Resolution: Done Votes: 1
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by GODRIVER-598 Cannot decode when any ObjectId field... Closed
Duplicate
is duplicated by GODRIVER-588 Cannot decode pointers to nil / canno... Closed
is duplicated by GODRIVER-652 StringEncodeValue should encode point... Closed
is duplicated by GODRIVER-656 Cannot decode null into a string type... Closed
is duplicated by GODRIVER-638 Support encoding for nil pointers Closed
Related
related to GODRIVER-494 BSON Codec Redesign Closed
is related to GODRIVER-598 Cannot decode when any ObjectId field... Closed

 Description   

With GODRIVER-494, new codecs were built for many of the base reflect.Kind types. These handle the base case of a non-pointer to those kinds, but there are circumstances in which a pointer to the kind should be handled. To enable this, the reflect.Kind codecs need to properly handle a pointer to the kind and the decode path needs to handle a pointer to a pointer to the kind.

A nil pointer maps to a BSON Null and a BSON Null maps to a nil pointer, so this functionality should be added.

Additionally, all of the BSON primitive type codecs should support pointers to their types.



 Comments   
Comment by Githook User [ 04/Dec/18 ]

Author:

{'name': 'Kris Brandow', 'email': 'kris@mongodb.com', 'username': 'skriptble'}

Message: Update codec system to use reflect.Value

Add support for pointers to the BSON codec system. When doing an
interface lookup for a decoder, we now check if the type or a pointer to
the type implement the interface. If either one does, we return the
decoder for that interface.

This change changes the ValueEncoder and ValueDecoder interfaces to use
reflect.Value instead of interface{}.

Move the bson.D family of types into the primitive package.

GODRIVER-535
GODRIVER-598
GODRIVER-588
GODRIVER-645
GODRIVER-662
GODRIVER-649
GODRIVER-670

Change-Id: Idec68f74e354973160bd59f9f8fef009f026f943
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/d305fc0b97b199028c9a7def35f931224c448665

Comment by Kristofer Brandow (Inactive) [ 28/Nov/18 ]

Code Review: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/435374.

Comment by Delio D'Anna [ 27/Nov/18 ]

Is still work in progress, check the github PR, this is a very important thing to fix though, I'm currently running a version of pandada8 branch patched by me in order to get things going but is seriously important to be able to handle pointers......strange not many people jumped into it

Comment by Alexandru Tripon [X] [ 27/Nov/18 ]

Hello guys,

Any news about this issue?

Thanks,
Trial97

Comment by pandada8 [ 19/Oct/18 ]

I create a rough PR for this, can someone help review this ?

Comment by Delio D'Anna [ 14/Oct/18 ]

Well this does not nail the whole pointer issue, I checked the code and when decoding the pointers get passed to the actual type decoder, meaning that either each decoder needs to handle also the pointers, like already happens for some, or something upfront must happen to handle the pointers

Comment by Andre Bazaglia [ 14/Oct/18 ]

Perhaps this is also the solution for #598?

Comment by Delio D'Anna [ 11/Oct/18 ]

Has anybody picked this up? I think is a pretty important issue

Generated at Thu Feb 08 08:34:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.