Add MapFromStringExt

This commit is contained in:
George Suntres
2026-04-25 10:54:05 -04:00
parent 13c75f62b1
commit 80a923f150

View File

@@ -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 {