summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-09-04 18:21:16 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-09-04 18:21:16 +0200 |
commit | 08a3d1e624d9fc935c81cb7c2d07d7daacfbbba9 (patch) | |
tree | e50e77f5124b5dee407feb078b578d57475262b1 /src/shared/struct/shr_map_summary.erl | |
parent | b02f349872c01f94e5234d4d122fa7ec18382068 (diff) |
Adds plr_load.
Diffstat (limited to 'src/shared/struct/shr_map_summary.erl')
-rw-r--r-- | src/shared/struct/shr_map_summary.erl | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/shared/struct/shr_map_summary.erl b/src/shared/struct/shr_map_summary.erl new file mode 100644 index 0000000..a7a1283 --- /dev/null +++ b/src/shared/struct/shr_map_summary.erl @@ -0,0 +1,102 @@ +-module(shr_map_summary). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-record +( + map_summary, + { + id :: binary(), + name :: binary() + } +). + +-opaque type() :: #map_summary{}. + +-export_type([type/0]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export +( + [ + new/2 + ] +). + +%%%% Accessors +-export +( + [ + get_id/1, + get_name/1 + ] +). +-export +( + [ + set_id/2, + set_name/2 + ] +). + +-export +( + [ + get_id_field/0, + get_name_field/0 + ] +). + +%%%% Export +-export +( + [ + encode/1 + ] +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec new (binary(), binary()) -> type(). +new (ID, Name) -> + #map_summary + { + id = ID, + name = Name + }. + +%%%% Accessors +-spec get_id (type()) -> binary(). +get_id (MapSummary) -> MapSummary#map_summary.id. + +-spec get_name (type()) -> binary(). +get_name (MapSummary) -> MapSummary#map_summary.name. + +-spec set_id (binary(), type()) -> type(). +set_id (Val, MapSummary) -> MapSummary#map_summary{ id = Val }. + +-spec set_name (binary(), type()) -> type(). +set_name (Val, MapSummary) -> MapSummary#map_summary{ name = Val }. + +-spec get_id_field () -> non_neg_integer(). +get_id_field () -> #map_summary.id. + +-spec get_name_field () -> non_neg_integer(). +get_name_field () -> #map_summary.name. + +-spec encode (type()) -> {list(any())}. +encode (MapSummary) -> + { + [ + {<<"id">>, MapSummary#map_summary.id}, + {<<"nme">>, MapSummary#map_summary.name} + ] + }. |