Add MapFromStringExt
This commit is contained in:
@@ -408,6 +408,15 @@ func MapFromString(s string) (map[string]any, error) {
|
|||||||
return b, nil
|
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.
|
// 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.
|
// Only fields' name is evaluated not their values.
|
||||||
func MapIsSubset(subset, superset any) bool {
|
func MapIsSubset(subset, superset any) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user