Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦境迷离
Zio Redis
提交
b40713b3
Z
Zio Redis
项目概览
梦境迷离
/
Zio Redis
12 个月 前同步成功
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
Zio Redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b40713b3
编写于
11月 21, 2020
作者:
J
Justin Heyes-Jones
提交者:
GitHub
11月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update Scan api to return Long instead of String (#211)
上级
35252724
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
31 addition
and
19 deletion
+31
-19
redis/src/main/scala/zio/redis/Output.scala
redis/src/main/scala/zio/redis/Output.scala
+3
-3
redis/src/main/scala/zio/redis/api/Hashes.scala
redis/src/main/scala/zio/redis/api/Hashes.scala
+1
-1
redis/src/main/scala/zio/redis/api/Keys.scala
redis/src/main/scala/zio/redis/api/Keys.scala
+1
-1
redis/src/main/scala/zio/redis/api/Sets.scala
redis/src/main/scala/zio/redis/api/Sets.scala
+2
-2
redis/src/main/scala/zio/redis/api/SortedSets.scala
redis/src/main/scala/zio/redis/api/SortedSets.scala
+1
-1
redis/src/test/scala/zio/redis/KeysSpec.scala
redis/src/test/scala/zio/redis/KeysSpec.scala
+1
-1
redis/src/test/scala/zio/redis/OutputSpec.scala
redis/src/test/scala/zio/redis/OutputSpec.scala
+1
-1
redis/src/test/scala/zio/redis/SetsSpec.scala
redis/src/test/scala/zio/redis/SetsSpec.scala
+16
-4
redis/src/test/scala/zio/redis/SortedSetsSpec.scala
redis/src/test/scala/zio/redis/SortedSetsSpec.scala
+5
-5
未找到文件。
redis/src/main/scala/zio/redis/Output.scala
浏览文件 @
b40713b3
...
...
@@ -110,16 +110,16 @@ object Output {
}
case
object
ScanOutput
extends
Output
[(
Stri
ng
,
Chunk
[
String
])]
{
case
object
ScanOutput
extends
Output
[(
Lo
ng
,
Chunk
[
String
])]
{
override
protected
def
tryDecode
(
respValue
:
RespValue
)
:
(
Stri
ng
,
Chunk
[
String
])
=
override
protected
def
tryDecode
(
respValue
:
RespValue
)
:
(
Lo
ng
,
Chunk
[
String
])
=
respValue
match
{
case
RespValue
.
ArrayValues
(
cursor
@
RespValue
.
BulkString
(
_
),
RespValue
.
Array
(
items
))
=>
val
strings
=
items
.
map
{
case
s
@
RespValue
.
BulkString
(
_
)
=>
s
.
asString
case
other
=>
s
"$other is not a bulk string"
}
(
cursor
.
asString
,
strings
)
(
cursor
.
asString
.
toLong
,
strings
)
case
other
=>
throw
ProtocolError
(
s
"$other isn't scan output"
)
}
...
...
redis/src/main/scala/zio/redis/api/Hashes.scala
浏览文件 @
b40713b3
...
...
@@ -36,7 +36,7 @@ trait Hashes {
b
:
Option
[
Regex
]
=
None
,
c
:
Option
[
Long
]
=
None
,
d
:
Option
[
String
]
=
None
)
:
ZIO
[
RedisExecutor
,
RedisError
,
(
Stri
ng
,
Chunk
[
String
])]
=
HScan
.
run
((
a
,
b
,
c
,
d
))
)
:
ZIO
[
RedisExecutor
,
RedisError
,
(
Lo
ng
,
Chunk
[
String
])]
=
HScan
.
run
((
a
,
b
,
c
,
d
))
final
def
hSet
(
a
:
String
,
b
:
(
String
,
String
),
bs
:
(
String
,
String
)*)
:
ZIO
[
RedisExecutor
,
RedisError
,
Long
]
=
HSet
.
run
((
a
,
(
b
,
bs
.
toList
)))
...
...
redis/src/main/scala/zio/redis/api/Keys.scala
浏览文件 @
b40713b3
...
...
@@ -68,7 +68,7 @@ trait Keys {
b
:
Option
[
Regex
]
=
None
,
c
:
Option
[
Long
]
=
None
,
d
:
Option
[
String
]
=
None
)
:
ZIO
[
RedisExecutor
,
RedisError
,
(
Stri
ng
,
Chunk
[
String
])]
=
Scan
.
run
((
a
,
b
,
c
,
d
))
)
:
ZIO
[
RedisExecutor
,
RedisError
,
(
Lo
ng
,
Chunk
[
String
])]
=
Scan
.
run
((
a
,
b
,
c
,
d
))
final
def
touch
(
a
:
String
,
as
:
String*
)
:
ZIO
[
RedisExecutor
,
RedisError
,
Long
]
=
Touch
.
run
((
a
,
as
.
toList
))
...
...
redis/src/main/scala/zio/redis/api/Sets.scala
浏览文件 @
b40713b3
...
...
@@ -145,14 +145,14 @@ trait Sets {
* @param cursor Cursor to use for this iteration of scan
* @param regex Glob-style pattern that filters which elements are returned
* @param count Count of elements. Roughly this number will be returned by Redis if possible
* @return Returns the
items for this iteration or nothing when you reach the end
* @return Returns the
next cursor, and items for this iteration or nothing when you reach the end, as a tuple
*/
final
def
sScan
(
key
:
String
,
cursor
:
Long
,
regex
:
Option
[
Regex
]
=
None
,
count
:
Option
[
Count
]
=
None
)
:
ZIO
[
RedisExecutor
,
RedisError
,
(
Stri
ng
,
Chunk
[
String
])]
=
SScan
.
run
((
key
,
cursor
,
regex
,
count
))
)
:
ZIO
[
RedisExecutor
,
RedisError
,
(
Lo
ng
,
Chunk
[
String
])]
=
SScan
.
run
((
key
,
cursor
,
regex
,
count
))
/**
* Add multiple sets
...
...
redis/src/main/scala/zio/redis/api/SortedSets.scala
浏览文件 @
b40713b3
...
...
@@ -325,7 +325,7 @@ trait SortedSets {
cursor
:
Long
,
regex
:
Option
[
Regex
]
=
None
,
count
:
Option
[
Count
]
=
None
)
:
ZIO
[
RedisExecutor
,
RedisError
,
(
Stri
ng
,
Chunk
[
String
])]
=
ZScan
.
run
((
key
,
cursor
,
regex
,
count
))
)
:
ZIO
[
RedisExecutor
,
RedisError
,
(
Lo
ng
,
Chunk
[
String
])]
=
ZScan
.
run
((
key
,
cursor
,
regex
,
count
))
/**
* Get the score associated with the given member in a sorted set.
...
...
redis/src/test/scala/zio/redis/KeysSpec.scala
浏览文件 @
b40713b3
...
...
@@ -84,7 +84,7 @@ trait KeysSpec extends BaseSpec {
_
<-
set
(
key
,
value
)
scan
<-
scan
(
0L
)
(
next
,
elements
)
=
scan
}
yield
assert
(
next
)(
is
NonEmptyString
)
&&
assert
(
elements
)(
isNonEmpty
)
}
yield
assert
(
next
)(
is
GreaterThan
(
0L
)
)
&&
assert
(
elements
)(
isNonEmpty
)
},
testM
(
"fetch random key"
)
{
for
{
...
...
redis/src/test/scala/zio/redis/OutputSpec.scala
浏览文件 @
b40713b3
...
...
@@ -138,7 +138,7 @@ object OutputSpec extends BaseSpec {
val
input
=
respArrayVals
(
respBulkString
(
"5"
),
respArray
(
"foo"
,
"bar"
))
for
{
res
<-
Task
(
ScanOutput
.
unsafeDecode
(
input
))
}
yield
assert
(
res
)(
equalTo
(
"5"
->
Chunk
(
"foo"
,
"bar"
)))
}
yield
assert
(
res
)(
equalTo
(
5L
->
Chunk
(
"foo"
,
"bar"
)))
}
),
suite
(
"string"
)(
...
...
redis/src/test/scala/zio/redis/SetsSpec.scala
浏览文件 @
b40713b3
...
...
@@ -738,7 +738,7 @@ trait SetsSpec extends BaseSpec {
_
<-
sAdd
(
key
,
"a"
,
"b"
,
"c"
)
scan
<-
sScan
(
key
,
0L
)
(
cursor
,
members
)
=
scan
}
yield
assert
(
cursor
)(
is
NonEmptyString
)
&&
}
yield
assert
(
cursor
)(
is
Zero
)
&&
assert
(
members
)(
isNonEmpty
)
},
testM
(
"empty set"
)
{
...
...
@@ -746,7 +746,7 @@ trait SetsSpec extends BaseSpec {
key
<-
uuid
scan
<-
sScan
(
key
,
0L
)
(
cursor
,
members
)
=
scan
}
yield
assert
(
cursor
)(
equalTo
(
"0"
)
)
&&
}
yield
assert
(
cursor
)(
isZero
)
&&
assert
(
members
)(
isEmpty
)
},
testM
(
"with match over non-empty set"
)
{
...
...
@@ -755,16 +755,28 @@ trait SetsSpec extends BaseSpec {
_
<-
sAdd
(
key
,
"one"
,
"two"
,
"three"
)
scan
<-
sScan
(
key
,
0L
,
Some
(
"t[a-z]*"
.
r
))
(
cursor
,
members
)
=
scan
}
yield
assert
(
cursor
)(
is
NonEmptyString
)
&&
}
yield
assert
(
cursor
)(
is
Zero
)
&&
assert
(
members
)(
isNonEmpty
)
},
testM
(
"with count over non-empty set with two iterations"
)
{
for
{
key
<-
uuid
_
<-
sAdd
(
key
,
"a"
,
"b"
,
"c"
,
"d"
,
"e"
)
scan
<-
sScan
(
key
,
0L
,
count
=
Some
(
Count
(
3L
)))
(
cursor
,
members
)
=
scan
scan2
<-
sScan
(
key
,
cursor
,
count
=
Some
(
Count
(
3L
)))
(
cursor2
,
members2
)
=
scan2
}
yield
assert
(
cursor
)(
isGreaterThan
(
0L
))
&&
assert
(
members
)(
isNonEmpty
)
&&
assert
(
cursor2
)(
isZero
)
},
testM
(
"with count over non-empty set"
)
{
for
{
key
<-
uuid
_
<-
sAdd
(
key
,
"a"
,
"b"
,
"c"
,
"d"
,
"e"
)
scan
<-
sScan
(
key
,
0L
,
count
=
Some
(
Count
(
3L
)))
(
cursor
,
members
)
=
scan
}
yield
assert
(
cursor
)(
is
NonEmptyString
)
&&
}
yield
assert
(
cursor
)(
is
GreaterThan
(
0L
)
)
&&
assert
(
members
)(
isNonEmpty
)
},
testM
(
"error when not set"
)
{
...
...
redis/src/test/scala/zio/redis/SortedSetsSpec.scala
浏览文件 @
b40713b3
...
...
@@ -794,14 +794,14 @@ trait SortedSetsSpec extends BaseSpec {
_
<-
zAdd
(
key
)(
MemberScore
(
1d
,
"atest"
),
MemberScore
(
2d
,
"btest"
),
MemberScore
(
3d
,
"ctest"
))
scan
<-
zScan
(
key
,
0L
)
(
cursor
,
members
)
=
scan
}
yield
assert
(
cursor
)(
is
NonEmptyString
)
&&
assert
(
members
)(
isNonEmpty
)
}
yield
assert
(
cursor
)(
is
Zero
)
&&
assert
(
members
)(
isNonEmpty
)
},
testM
(
"empty set"
)
{
for
{
key
<-
uuid
scan
<-
zScan
(
key
,
0L
)
(
cursor
,
members
)
=
scan
}
yield
assert
(
cursor
)(
equalTo
(
"0"
)
)
&&
assert
(
members
)(
isEmpty
)
}
yield
assert
(
cursor
)(
isZero
)
&&
assert
(
members
)(
isEmpty
)
},
testM
(
"with match over non-empty set"
)
{
for
{
...
...
@@ -809,7 +809,7 @@ trait SortedSetsSpec extends BaseSpec {
_
<-
zAdd
(
key
)(
MemberScore
(
1d
,
"one"
),
MemberScore
(
2d
,
"two"
),
MemberScore
(
3d
,
"three"
))
scan
<-
zScan
(
key
,
0L
,
Some
(
"t[a-z]*"
.
r
))
(
cursor
,
members
)
=
scan
}
yield
assert
(
cursor
)(
is
NonEmptyString
)
&&
assert
(
members
)(
isNonEmpty
)
}
yield
assert
(
cursor
)(
is
Zero
)
&&
assert
(
members
)(
isNonEmpty
)
},
testM
(
"with count over non-empty set"
)
{
for
{
...
...
@@ -823,7 +823,7 @@ trait SortedSetsSpec extends BaseSpec {
)
scan
<-
zScan
(
key
,
0L
,
None
,
Some
(
Count
(
3L
)))
(
cursor
,
members
)
=
scan
}
yield
assert
(
cursor
)(
is
NonEmptyString
)
&&
assert
(
members
)(
isNonEmpty
)
}
yield
assert
(
cursor
)(
is
Zero
)
&&
assert
(
members
)(
isNonEmpty
)
},
testM
(
"match with count over non-empty set"
)
{
for
{
...
...
@@ -837,7 +837,7 @@ trait SortedSetsSpec extends BaseSpec {
)
scan
<-
zScan
(
key
,
0L
,
Some
(
"t[a-z]*"
.
r
),
Some
(
Count
(
3L
)))
(
cursor
,
members
)
=
scan
}
yield
assert
(
cursor
)(
is
NonEmptyString
)
&&
assert
(
members
)(
isNonEmpty
)
}
yield
assert
(
cursor
)(
is
Zero
)
&&
assert
(
members
)(
isNonEmpty
)
},
testM
(
"error when not set"
)
{
for
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录