From ea3165fbdd29d69c6a348ca0e6860fdc856a8a1d Mon Sep 17 00:00:00 2001 From: Ryan Gahl Date: Thu, 6 Dec 2018 19:24:05 -0600 Subject: [PATCH] handle decimal128 --- marshal.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/marshal.go b/marshal.go index c07b042..03d45e4 100644 --- a/marshal.go +++ b/marshal.go @@ -47,6 +47,8 @@ func Marshal(in interface{}) (interface{}, error) { return marshalTimestamp(v), nil case bson.RegEx: return marshalRegex(v), nil + case bson.Decimal128: + return marshalDecimal128(v), nil case string, int, int64, bool, float64, uint8, uint32: return v, nil default: @@ -111,3 +113,9 @@ func marshalRegex(in bson.RegEx) map[string]interface{} { "$options": in.Options, } } + +func marshalDecimal128(in bson.Decimal128) map[string]interface{} { + return map[string]interface{}{ + "$decimal128": in.String(), + } +}