我有在 ETS 表中存储一些数据的模块现在我正在尝试过滤迭代 ETS 表的数据,但总是为空 [List]。(这个每次都匹配——matching('$end_of_table', Acc) -> Acc;)
-module(t).
-export([matching/0]).
matching() -> matching(ets:first(auth), []).
matching('$end_of_table', Acc) -> Acc;
matching(Key, Acc) ->
FromSec = calendar:datetime_to_gregorian_seconds({{2017,1,12}, {11,00,00}}),
ToSec = calendar:datetime_to_gregorian_seconds({{2017,1,12}, {12,00,00}}),
case ets:lookup(auth, Key) of
[{Login, Pass, TTL, Unix, Unix2}] when Unix2 >= FromSec, Unix2 =< ToSec -> NewAcc = [{Login, Pass, TTL, Unix, Unix2}|Acc],
N = ets:next(auth, Key),
matching(N, NewAcc);
_ -> N = ets:next(auth, Key),
matching(N, Acc)
end.
可能是我错误地创建了 ETS 表吗?