Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyang-hu committed Dec 2, 2023
1 parent c7f3a17 commit d9a1e55
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 65 deletions.
22 changes: 0 additions & 22 deletions bson/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,6 @@ func Marshal(val interface{}) ([]byte, error) {
return buf.Bytes(), nil
}

// MarshalWithRegistry returns the BSON encoding of val as a BSON document. If val is not a type that can be transformed
// into a document, MarshalValueWithRegistry should be used instead.
//
// Deprecated: Use [NewEncoder] and specify the Registry by calling [Encoder.SetRegistry] instead:
//
// buf := new(bytes.Buffer)
// vw, err := bsonrw.NewBSONValueWriter(buf)
// if err != nil {
// panic(err)
// }
// enc, err := bson.NewEncoder(vw)
// if err != nil {
// panic(err)
// }
// enc.SetRegistry(reg)
//
// See [Encoder] for more examples.
func MarshalWithRegistry(r *bsoncodec.Registry, val interface{}) ([]byte, error) {
dst := make([]byte, 0)
return MarshalAppendWithRegistry(r, dst, val)
}

// MarshalWithContext returns the BSON encoding of val as a BSON document using EncodeContext ec. If val is not a type
// that can be transformed into a document, MarshalValueWithContext should be used instead.
//
Expand Down
Loading

0 comments on commit d9a1e55

Please sign in to comment.