Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

handle decimal128 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(),
}
}