Skip to content

Yozhig/rconv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rconv

Parse transform for fast record to map and map to record conversions without boilerplate for Erlang.

Usage

Add dependency to your rebar.config

    {deps, [
        {rconv, {git, "https://github.com/Yozhig/rconv.git", {tag, "0.2.0"}}},
    ]}

and compile option for parse transform at the top of the source file

    -module(your_module_name).

    -compile([{parse_transform, rconv}]).

or to an erl_opts.

Now you can use rconv:to_map/2 and rconv:from_map/2 which will be transformed at the compile time

    Map = rconv:to_map(Record, your_record_name),
    Record = rconv:from_map(Map, your_record_name)

See unit tests for sample usage.