Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2714

Don't use "*Context" types to configure BSON "Encoder" or "Decoder"

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.0.0
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • Major Change
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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.

            Assignee:
            qingyang.hu@mongodb.com Qingyang Hu
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: