refactoring.
This commit is contained in:
parent
276a183738
commit
a7ffc84343
1 changed files with 10 additions and 8 deletions
|
@ -45,6 +45,16 @@ removeItem(Db,Ns,Key) ->
|
|||
mnesia:transaction(Fun).
|
||||
|
||||
|
||||
clear(Db,Ns) ->
|
||||
Fun = fun() ->
|
||||
Keys = mnesia:all_keys(data),
|
||||
Rest = lists:filter(fun({A,B,_}) -> ((A==Db) and (B==Ns)) end, Keys),
|
||||
lists:map(fun({A,B,C}) -> removeItem(A,B,C) end, Rest)
|
||||
end,
|
||||
{atomic, Ret} = mnesia:transaction(Fun),
|
||||
Ret.
|
||||
|
||||
|
||||
%%-----------------------------------------------------
|
||||
%% Querries
|
||||
%%-----------------------------------------------------
|
||||
|
@ -73,12 +83,4 @@ key(Db,Ns,Position) ->
|
|||
Ret.
|
||||
|
||||
|
||||
clear(Db,Ns) ->
|
||||
Fun = fun() ->
|
||||
Keys = mnesia:all_keys(data),
|
||||
Rest = lists:filter(fun({A,B,_}) -> ((A==Db) and (B==Ns)) end, Keys),
|
||||
lists:map(fun({A,B,C}) -> removeItem(A,B,C) end, Rest)
|
||||
end,
|
||||
{atomic, Ret} = mnesia:transaction(Fun),
|
||||
Ret.
|
||||
|
||||
|
|
Reference in a new issue