Details
-
Improvement
-
Resolution: Fixed
-
Major - P3
-
None
-
None
Description
Introduce an unexported typeDecoder interface to bsoncodec:
type typeDecoder interface { |
decodeType(DecodeContext, bsonrw.ValueReader) (reflect.Value, error)
|
}
|
Also add a decodeAdapter type that contains both a typeDecoder and ValueDecoder which can be added to a Registry.
Modify EmptyInterfaceCodec to implement both typeDecoder and ValueDecoder. When delegating to another codec, it should delegate to typeDecoder if possible and fallback to ValueDecoder if not.
Add a dedicated bson.D decoder which delegates to the typeDecoder for interface{} if it exists (which it should in the default case) and falls back to ValueDecoder if not (e.g. if the decoder for interface{} has been overriden).
Attachments
Issue Links
- has to be done before
-
GODRIVER-1681 Add typeDecoder implementations for all non-recursive types
-
- Closed
-
-
GODRIVER-1682 Call typeDecoder from recursive decoders
-
- Closed
-