View Source recon_map (recon v2.5.3)

This module handles formatting maps. It allows for trimming output to selected fields, or to nothing at all. It also adds a label to a printout. To set up a limit for a map, you need to give recon a way to tell the map you want to trim from all the other maps, so you have to provide something like a 'type definition'. It can be either another map which is compared to the arg, or a fun.

Link to this section Summary

Functions

remove all imported definitions, destroy the table, clean up
quickly check if we want to do any record formatting

Limit output to selected keys of a map (can be 'none', 'all', a key or a list of keys). Pattern selects maps to process: a "pattern" is just a map, and if all key/value pairs of a pattern are present in a map (in other words, the pattern is a subset), then we say the map matches and we process it accordingly (apply the limit).

prints out all "known" map definitions and their limit settings. Printout tells a map's name, the matching fields required, and the limit options.
remove a given map entry
rename a given map entry, which allows to to change priorities for matching. The first argument is the current name, and the second argument is the new name.

Link to this section Types

-type limit() :: all | none | atom() | binary() | [any()].
-type map_label() :: atom().
-type pattern() :: map() | function().

Link to this section Functions

remove all imported definitions, destroy the table, clean up
-spec is_active() -> boolean().
quickly check if we want to do any record formatting
Link to this function

limit(Label, Pattern, Limit)

View Source
-spec limit(map_label(), pattern(), limit()) -> ok | {error, any()}.

Limit output to selected keys of a map (can be 'none', 'all', a key or a list of keys). Pattern selects maps to process: a "pattern" is just a map, and if all key/value pairs of a pattern are present in a map (in other words, the pattern is a subset), then we say the map matches and we process it accordingly (apply the limit).

Patterns are applied in alphabetical order, until a match is found.

Instead of a pattern you can also provide a function which will take a map and return a boolean.
prints out all "known" map definitions and their limit settings. Printout tells a map's name, the matching fields required, and the limit options.
-spec remove(map_label()) -> true.
remove a given map entry
-spec rename(map_label(), map_label()) -> renamed | missing.
rename a given map entry, which allows to to change priorities for matching. The first argument is the current name, and the second argument is the new name.