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. |
deep_update/3 | If Path exists in Map1 , the old associated value is replaced by value
Value . |
deep_update_with/3 | Update a value in a Map1 associated with Path by calling Fun on the
old value to get a new value. |
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}
if Map
is not a map{badpath,Path}
if Path
is not a pathdeep_get(Path::path(), Map::map()) -> term()
Returns value Value
associated with Path
if Map
contains Path
.
{badmap,Map}
if Map
is not a map{badpath,Path}
if Path
is not a path{badvalue,P}
if a term that is not a map exists as a intermediate key at
the path P
{badkey,Path}
if no value is associated with path 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}
if Map
is not a map{badpath,Path}
if Path
is not a path{badvalue,P}
if a term that is not a map exists as a intermediate key at
the path P
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 can raise the following exceptions:{badmap,Map}
exception if any of the maps is not a mapdeep_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 mapdeep_put(Path::path(), Value::term(), Map1::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}
if Map1
is not a map{badpath,Path}
if Path
is not a path{badvalue,P}
if a term that is not a map exists as a intermediate key at
the path P
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}
if Map
is not a map{badpath,Path}
if Path
is not a pathdeep_update(Path::path(), Value::term(), Map1::map()) -> map()
If Path
exists in Map1
, the old associated value is replaced by value
Value
. The function returns a new map Map2
containing the new associated
value.
{badmap,Map}
if Map1
is not a map{badpath,Path}
if Path
is not a path{badvalue,P}
if a term that is not a map exists as a intermediate key at
the path P
{badkey,Path}
if no value is associated with path Path
deep_update_with(Path::path(), Fun::fun((term()) -> term()), Map1::map()) -> map()
Update a value in a Map1
associated with Path
by calling Fun
on the
old value to get a new value.
{badmap,Map}
if Map1
is not a map{badpath,Path}
if Path
is not a path{badvalue,P}
if a term that is not a map exists as a intermediate key at
the path P
{badkey,Path}
if no value is associated with path Path
badarg
if Fun
is not a function of arity 1inverse(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}
if Map
is not a mapGenerated by EDoc