This commit is contained in:
Feng 2015-10-01 11:22:18 +08:00
parent af14bf9329
commit d7ca17b336
1 changed files with 15 additions and 0 deletions

View File

@ -35,6 +35,8 @@
-export([create_table/2, copy_table/1]).
-export([dump/3]).
start() ->
case init_schema() of
ok ->
@ -168,3 +170,16 @@ wait_for_mnesia(stop) ->
{error, mnesia_unexpectedly_starting}
end.
dump(ets, Table, Fun) ->
dump(ets, Table, ets:first(Table), Fun).
dump(ets, _Table, '$end_of_table', _Fun) ->
ok;
dump(ets, Table, Key, Fun) ->
case ets:lookup(Table, Key) of
[Record] -> Fun(Record);
[] -> ignore
end,
dump(ets, Table, ets:next(Table, Key), Fun).