mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-03 06:50:24 +08:00
使用KV数据库来管理IP名单
This commit is contained in:
@@ -138,6 +138,26 @@ func TestQuery_FindAll_Offset(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestQuery_FindAll_Skip(t *testing.T) {
|
||||
var table = testOpenStoreTable[*testCachedItem](t, "cache_items", &testCacheItemEncoder[*testCachedItem]{})
|
||||
|
||||
{
|
||||
err := table.Query().
|
||||
Offset("a3").
|
||||
Limit(10).
|
||||
FindAll(func(tx *kvstore.Tx[*testCachedItem], item kvstore.Item[*testCachedItem]) (goNext bool, err error) {
|
||||
if item.Key == "a30" || item.Key == "a3000005" {
|
||||
return kvstore.Skip()
|
||||
}
|
||||
t.Log("key:", item.Key, "value:", item.Value)
|
||||
return true, nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestQuery_FindAll_Count(t *testing.T) {
|
||||
var table = testOpenStoreTable[*testCachedItem](t, "cache_items", &testCacheItemEncoder[*testCachedItem]{})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user