Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/doitian/record_spec

Export record info for runtime
https://github.com/doitian/record_spec

Last synced: about 1 month ago
JSON representation

Export record info for runtime

Awesome Lists containing this project

README

        

# Record Spec

Generate record info for runtime.

## Usage

Add `record_spec` as a dependency in `rebar.config`.

{deps, [{record_spec, ".*", {git, "git://github.com/3pjgames/record_spec.git"}}]}.

Add following code to export records, e.g., `user` and `group`.

-include("record_spec/include/record_spec.hrl").
-export_record_spec([user, group]).

See example below

```erlang
-module(models).
-include("record_spec/include/record_spec.hrl").
-record(user, { name :: binary(),
age :: integer() }).

-record(group, { name :: binary(),
users :: [#user{}] }).

-export_record_spec([user, group]).
```