Module uef_maps

Data Types

find_result()

find_result() = {ok, term()} | error

mapkey()

mapkey() = term()

mapkeys()

mapkeys() = [mapkey()]

Function Index

delete_nested/2 The function removes key KeyN, if it exists, and its associated value from the corresponding internal map and updates the entire structure of map Map1 getting new map Map2.
find_nested/2 Returns tuple {ok, Value}, where Value is the value associated with the last element of list Keys, or error if no value is found.
get_nested/2 Returns value Value associated with the last element of list Keys.
get_nested/3 Returns value Value associated with the last element of list Keys.
is_key_nested/2 Returns true if map Map contains submaps as values associated with their own key corresponding to the element of list Keys, and returns false otherwise.
new_nested/1 Same as uef_maps:new_nested(Keys, #{}).
new_nested/2 Returns new nested map Map with the deepest map #{LastKey => Value}, where LastKey is the last element of list Keys.
put_nested/3 The function associates KeyN with value Value and updates the entire structure of map Map1 returning new map Map2.
remove_nested/2 The function removes key KeyN, if it exists, and its associated value from the corresponding internal map and updates the entire structure of map Map1 returning new map Map2.
take_nested/2 The function removes key KeyN, if it exists, and its associated value Value from the corresponding internal map and updates the entire structure of map Map1 returning tuple {Value, Map2}.
update_nested/3 Works similar to uef_maps:put_nested/3 with the difference that it fails with a {badkey,SomeKey} exception if SomeKey does not exist in the structure of map Map1, where SomeKey is one of the elements of list Keys.

Function Details

delete_nested/2

delete_nested(Keys::mapkeys(), Map1::map()) -> {ok, Map2::map()} | {error, {badkey, mapkey()}} | {error, empty_keys}

The function removes key KeyN, if it exists, and its associated value from the corresponding internal map and updates the entire structure of map Map1 getting new map Map2. KeyN is the last element of list Keys.

find_nested/2

find_nested(Keys::mapkeys(), Map::map()) -> find_result()

Returns tuple {ok, Value}, where Value is the value associated with the last element of list Keys, or error if no value is found. The call fails with a {badmap,Map} exception if Map is not a map, or with a {badlist,Keys} exception if Keys is not a list.

get_nested/2

get_nested(Keys::mapkeys(), Map::map()) -> Value::term()

Returns value Value associated with the last element of list Keys. The call fails with a {badmap,Map} exception if Map is not a map, or with a {badkeys,Keys} exception if no value is found, or with a {badlist,Keys} exception if Keys is not a list.

get_nested/3

get_nested(Keys::mapkeys(), Map::map(), Default::term()) -> Value::term()

Returns value Value associated with the last element of list Keys. If no value is found, Default is returned. The call fails with a {badmap,Map} exception if Map is not a map, or with a {badlist,Keys} exception if Keys is not a list. It does not fail if any internal value associated with any element of list Keys is not a map.

is_key_nested/2

is_key_nested(Keys::mapkeys(), Map::map()) -> boolean()

Returns true if map Map contains submaps as values associated with their own key corresponding to the element of list Keys, and returns false otherwise. The call fails with a {badmap,Map} exception if Map is not a map, or with a {badlist,Keys} exception if Keys is not a list.

new_nested/1

new_nested(Keys::mapkeys()) -> map()

Same as uef_maps:new_nested(Keys, #{}). See docs of uef_maps:new_nested/2.

new_nested/2

new_nested(Keys::mapkeys(), Value::term()) -> Map::map()

Returns new nested map Map with the deepest map #{LastKey => Value}, where LastKey is the last element of list Keys. The call fails with a {badlist,Keys} exception if Keys is not a list.

put_nested/3

put_nested(Keys::mapkeys(), Value::term(), Map1::map()) -> Map2::map()

The function associates KeyN with value Value and updates the entire structure of map Map1 returning new map Map2. If some keys from list Keys are not in the structure of map Map1, they will be inserted into the structure of map Map2 in the same order. The call fails with a {badmap,Map1} exception if Map1 is not a map, or with a {badlist,Keys} exception if Keys is not a list.

remove_nested/2

remove_nested(Keys::mapkeys(), Map1::map()) -> Map2::map()

The function removes key KeyN, if it exists, and its associated value from the corresponding internal map and updates the entire structure of map Map1 returning new map Map2. If some keys from list Keys are not in the structure of map Map1 the function returns a map without changes. The call fails with a {badmap,Map1} exception if Map1 is not a map, or with a {badlist,Keys} exception if Keys is not a list.

take_nested/2

take_nested(Keys::mapkeys(), Map1::map()) -> {Value::term(), Map2::map()} | error

The function removes key KeyN, if it exists, and its associated value Value from the corresponding internal map and updates the entire structure of map Map1 returning tuple {Value, Map2}. If some keys from list Keys are not in the structure of map Map1 the function returns error. The call fails with a {badmap,Map1} exception if Map1 is not a map, or with a {badlist,Keys} exception if Keys is not a list.

update_nested/3

update_nested(Keys::mapkeys(), Value::term(), Map::map()) -> map()

Works similar to uef_maps:put_nested/3 with the difference that it fails with a {badkey,SomeKey} exception if SomeKey does not exist in the structure of map Map1, where SomeKey is one of the elements of list Keys. The call also fails with a {badmap,Map1} exception if Map1 is not a map, or with a {badlist,Keys} exception if Keys is not a list.


Generated by EDoc