-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
The bson.Encoder is responsible for encoding the provided type into an io.Writer.
The steps are as follows:
- Determine if the provided type implements the bson.Marshaler interface, if it does call the MarshalBSON method and we're done
- Reflect the type and determine the elements to create, using struct tags if available.
- 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.
- is depended on by
-
GODRIVER-179 Add testing for bson.Encoder
- Closed
- is related to
-
GODRIVER-363 BSON encode and decoder do not support time.Time, url.URL, or json.Number
- Closed