Recon

Module recon_rec

This module handles formatting records for known record types.

Authors: bartlomiej.gorny@erlang-solutions.com.

Description

This module handles formatting records for known record types. Record definitions are imported from modules by user. Definitions are distinguished by record name and its arity, if you have multiple records of the same name and size, you have to choose one of them and some of your records may be wrongly labelled. You can manipulate your definition list by using import/1 and clear/1, and check which definitions are in use by executing list/0.

Data Types

field()

field() = atom()

import_result()

import_result() = {imported, module(), record_name(), arity()} | {overwritten, module(), record_name(), arity()} | {ignored, module(), record_name(), arity(), module()}

limit()

limit() = all | none | field() | [field()]

listentry()

listentry() = {module(), record_name(), [field()], limit()}

record_name()

record_name() = atom()

compound

Function Index

clear/0remove all imported definitions, destroy the table, clean up.
clear/1remove definitions imported from a module.
get_list/0returns a list of active record definitions.
import/1import record definitions from a module.
is_active/0quickly check if we want to do any record formatting.
limit/3Limit output to selected fields of a record (can be 'none', 'all', a field or a list of fields).
list/0prints out all "known" (imported) record definitions and their limit settings.

Function Details

clear/0

clear() -> any()

remove all imported definitions, destroy the table, clean up

clear/1

clear(Module) -> any()

remove definitions imported from a module.

get_list/0

get_list() -> [listentry()]

returns a list of active record definitions

import/1

import(Modules::module() | [module()]) -> import_result() | [import_result()]

import record definitions from a module. If a record definition of the same name and arity has already been imported from another module then the new definition is ignored (returned info tells you from which module the existing definition was imported). You have to choose one and possibly remove the old one using clear/1. Supports importing multiple modules at once (by giving a list of atoms as an argument).

is_active/0

is_active() -> boolean()

quickly check if we want to do any record formatting

limit/3

limit(Name::record_name(), Arity::arity(), Limit::limit()) -> ok | {error, record_unknown}

Limit output to selected fields of a record (can be 'none', 'all', a field or a list of fields). Limit set to 'none' means there is no limit, and all fields are displayed; limit 'all' means that all fields are squashed and only record name will be shown.

list/0

list() -> any()

prints out all "known" (imported) record definitions and their limit settings. Print out tells module a record originates from, its name and a list of field names, plus the record's arity (may be handy if handling big records) and a list of field it limits its output to, if set.