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

Design and write first-draft of bson.Encoder

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 0.0.1
    • None
    • None
    • None

    Description

      The bson.Encoder is responsible for encoding the provided type into an io.Writer.

      The steps are as follows:

      1. Determine if the provided type implements the bson.Marshaler interface, if it does call the MarshalBSON method and we're done
      2. Reflect the type and determine the elements to create, using struct tags if available.
      3. Incrementally build up a builder.DocumentBuilder through this process, then write the finished document to the io.Writer

      Add custom types for Binary, Undefined, ObjectId, Timestamp, Null, Regex, DBPointer, Javascript, Symbol, CodeWithScope, and Min/Max key.

      Support all the types that mgo/bson supports: json.Number, time.Time, and url.URL.

      Support struct tags from mgo/bson: omitempty, minsize, and inline. Add support for specifying the type as a struct tag.

      For the ObjectId type: use SHA256 for generating the machine identifier.

      Attachments

        Activity

          People

            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: