Permalink
Browse files

refactored keytype into boss_record_lib

  • Loading branch information...
bunnylushington committed Sep 20, 2012
1 parent c1b6a9a commit a27c3d711e672a5b8e701bdd12ea697589afd50a
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/boss_db_mock_controller.erl
@@ -48,12 +48,12 @@ handle_call({save_record, Record}, _From, [{Dict, IdCounter}|OldState]) ->
Type = element(1, Record),
TypeString = atom_to_list(Type),
{Id, IdCounter1} = case Record:id() of
- id -> case keytype(Record) of
+ id -> case boss_record_lib:keytype(Record) of
uuid -> {lists:concat([Type, "-", uuid:to_string(uuid:uuid4())]), IdCounter};
_ -> {lists:concat([Type, "-", IdCounter]), IdCounter + 1}
end;
ExistingId ->
- case keytype(Record) of
+ case boss_record_lib:keytype(Record) of
uuid -> {ExistingId, IdCounter};
_ ->
[TypeString, IdNum] = string:tokens(ExistingId, "-"),
@@ -96,9 +96,6 @@ handle_info(_Info, State) ->
{noreply, State}.
-keytype(Record) ->
- proplists:get_value(id, Record:attribute_types(), unspecified).
-
do_find(Dict, Type, Conditions, Max, Skip, SortBy, SortOrder) ->
Tail = lists:nthtail(Skip,
lists:sort(fun(RecordA, RecordB) ->

0 comments on commit a27c3d7

Please sign in to comment.