diff --git a/struct.go b/struct.go index 30054d0..219e23e 100644 --- a/struct.go +++ b/struct.go @@ -408,6 +408,15 @@ func MapFromString(s string) (map[string]any, error) { return b, nil } +func MapFromStringExt(s string) (map[string]any, error) { + var b map[string]any + if err := bson.UnmarshalExtJSON([]byte(s), true, &b); err != nil { + return nil, err + } + + return b, nil +} + // MapIsSubset given two map[string]any m1 and m2 will determine if m1 is a subset of m2. // Only fields' name is evaluated not their values. func MapIsSubset(subset, superset any) bool {