Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (24 sloc) 0.963 kb
-compile({parse_transform, hcr_accessors}).
-module(hcr_model).
-include("hcr.hrl").
-export([new/1, perform_action/1]).
-export_type([property/0]).
-type property() :: {v1, non_neg_integer()}.
?ATTR_ACCESSOR([{v1, 0}]).
%% Represent model as tagged proplist, to able to have
%% somewhat useful -specs and make sure we are dealing
%% with the right model in the accessors.
%%
%% We could use the type aka primary key as an additional
%% element in the tuple, e.g. {g8_tree, pine, [Property]}
-spec new(hcr_config:type()) -> model().
new(Type) -> {?MODULE, Type, []}.
-spec perform_action(model()) -> model().
perform_action({?MODULE, _, _} = M) -> v1(M, v1(M) + hcr_config:incr1(M)).
%% ===================================================================
%% Accessors
%% ===================================================================
%% ... auto-generated by parse-transform like this
%% -export([v1/1, v1/2]).
%% v1(M) -> ...
%% v1(M, V) -> ...
Jump to Line
Something went wrong with that request. Please try again.