path() = [term()]
A list of keys that are used to iterate deeper into a map of maps.
deep_find/2 | Returns a tuple {ok,Value} , where Value is the value associated with
Path , or error if no value is associated with Path in Map . |
deep_get/2 | Returns value Value associated with Path if Map contains Path . |
deep_get/3 | Returns value Value associated with Path if Map contains Path . |
deep_merge/1 | Merges a list of maps recursively into a single map. |
deep_merge/2 | Equivalent to deep_merge([Map1, Map2]). |
deep_merge/3 | Merges a list of maps Maps recursively into a single map Target . |
deep_put/3 | Associates Path with value Value and inserts the association into map
Map2 . |
deep_remove/2 | Removes the last existing key of Path , and its associated value from
Map1 and returns a new map Map2 without that key. |
inverse/1 | Inverts Map by inserting each value as the key with its corresponding
key as the value. |
deep_find(Path::path(), Map::map()) -> {ok, term()} | error
Returns a tuple {ok,Value}
, where Value is the value associated with
Path
, or error
if no value is associated with Path
in Map
.
{badmap,Map}
exception if Map
is not a map, or with
a {badpath,Path}
exception if Path
is not a path.
deep_get(Path::path(), Map::map()) -> term()
Returns value Value
associated with Path
if Map
contains Path
.
{badmap,Map}
exception if Map
is not a map, or with
a {badpath,Path}
exception if Path
is not a path.
deep_get(Path::path(), Map::map(), Default::term()) -> term()
Returns value Value
associated with Path
if Map
contains Path
. If
no value is associated with Path
, Default
is returned.
{badmap,Map}
exception if Map
is not a map, or with
a {badpath,Path}
exception if Path
is not a path.
deep_merge(Maps::[map()]) -> map()
Equivalent to deep_merge(fun (_, V) -> V end, #{}, Maps).
Merges a list of maps recursively into a single map. If a path exist in several maps, the value in the first nested map is superseded by the value in a following nested map.
The call fails with a{badmap,Map}
exception if Map1
or Map2
is not a
map.
deep_merge(Map1::map(), Map2::map()) -> map()
Equivalent to deep_merge([Map1, Map2]).
deep_merge(Fun::fun((Old::term(), New::term()) -> term()), Target::map(), Maps::map() | [map()]) -> map()
Merges a list of maps Maps
recursively into a single map Target
. If a
path exist in several maps, the function Fun
is called with the previous and
the conflicting value to resolve the conflict. The return value from the
function is put into the resulting map.
{badmap,Map}
exception if any of the maps is not a
map.
deep_put(Path::path(), Value::term(), Map::map()) -> map()
Associates Path
with value Value
and inserts the association into map
Map2
. If path Path
already exists in map Map1
, the old associated value
is replaced by value Value
. The function returns a new map Map2
containing
the new association and the old associations in Map1
.
{badmap,Map}
exception if Map
is not a map, or with
a {badpath,Path}
exception if Path
is not a path. {badvalue,Term}
is
raised if a term that is not a map exists as a intermediate key in the path.
deep_remove(Path::path(), Map::map()) -> map()
Removes the last existing key of Path
, and its associated value from
Map1
and returns a new map Map2
without that key. Any deeper non-existing
keys are ignored.
{badmap,Map}
exception if Map
is not a map, or with
a {badpath,Path}
exception if Path
is not a path.
inverse(Map::map()) -> map()
Inverts Map
by inserting each value as the key with its corresponding
key as the value. If two keys have the same value, one of the keys will be
overwritten by the other in an undefined order.
{badmap,Map}
exception if Map
is not a map.
Generated by EDoc