[GODRIVER-2714] Don't use "*Context" types to configure BSON "Encoder" or "Decoder" Created: 23/Dec/22  Updated: 08/Jan/24

Status: Backlog
Project: Go Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: 2.0.0

Type: Improvement Priority: Unknown
Reporter: Matt Dale Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Go Driver 2.0 BSON
Quarter: FY24Q3
Backwards Compatibility: Major Change

 Description   

The APIs that accept EncodeContext and DecodeContext create a lot of unnecessary duplication in the bson package API. For example, there are currently multiple ways to configure a bson.Encoder or bson.Decoder:

  • Set a Registry directly on the Encoder via SetRegistry.
  • Set a Registry in an EncodeContext via SetContext.

Remove all bson APIs that accept an EncodeContext or DecodeContext for configuring a Encoder or Decoder. Keep the EncodeContext and DecodeContext in the ValueEncoder and ValueDecoder APIs.

Definition of done:

  • Remove all bson APIs that accept an EncodeContext or DecodeContext for configuring a Encoder or Decoder.
  • Add functions to the bson.Encoder API to replace all behaviors configurable via a bson.EncodeContext.
  • Add functions to the bson.Decoder API to replace all behaviors configurable via a bson.DecodeContext.

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