Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦境迷离
Zio Redis
提交
3792875d
Z
Zio Redis
项目概览
梦境迷离
/
Zio Redis
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
3792875d
编写于
3月 29, 2023
作者:
D
Dejan Mijić
提交者:
GitHub
3月 29, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ensure naming consistency (#791)
上级
e49ea4aa
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
15 addition
and
15 deletion
+15
-15
.github/workflows/site.yml
.github/workflows/site.yml
+6
-6
example/src/main/scala/example/ApiError.scala
example/src/main/scala/example/ApiError.scala
+1
-1
example/src/main/scala/example/api/Api.scala
example/src/main/scala/example/api/Api.scala
+1
-1
redis/src/main/scala/zio/redis/ClusterExecutor.scala
redis/src/main/scala/zio/redis/ClusterExecutor.scala
+1
-1
redis/src/main/scala/zio/redis/Output.scala
redis/src/main/scala/zio/redis/Output.scala
+1
-1
redis/src/main/scala/zio/redis/internal/RespCommandArgument.scala
...c/main/scala/zio/redis/internal/RespCommandArgument.scala
+2
-2
redis/src/main/scala/zio/redis/internal/RespValue.scala
redis/src/main/scala/zio/redis/internal/RespValue.scala
+3
-3
未找到文件。
.github/workflows/site.yml
浏览文件 @
3792875d
...
...
@@ -18,11 +18,11 @@ jobs:
if
:
${{ github.event_name == 'pull_request' }}
steps
:
-
name
:
Git Checkout
uses
:
actions/checkout@v3.
5
.0
uses
:
actions/checkout@v3.
3
.0
with
:
fetch-depth
:
'
0'
-
name
:
Setup Scala
uses
:
actions/setup-java@v3.
11
.0
uses
:
actions/setup-java@v3.
9
.0
with
:
distribution
:
temurin
java-version
:
17
...
...
@@ -41,11 +41,11 @@ jobs:
if
:
${{ ((github.event_name == 'release') && (github.event.action == 'published')) || (github.event_name == 'workflow_dispatch') }}
steps
:
-
name
:
Git Checkout
uses
:
actions/checkout@v3.
5
.0
uses
:
actions/checkout@v3.
3
.0
with
:
fetch-depth
:
'
0'
-
name
:
Setup Scala
uses
:
actions/setup-java@v3.
11
.0
uses
:
actions/setup-java@v3.
9
.0
with
:
distribution
:
temurin
java-version
:
17
...
...
@@ -65,12 +65,12 @@ jobs:
if
:
${{ (github.event_name == 'push') || ((github.event_name == 'release') && (github.event.action == 'published')) }}
steps
:
-
name
:
Git Checkout
uses
:
actions/checkout@v3.
5
.0
uses
:
actions/checkout@v3.
3
.0
with
:
ref
:
${{ github.head_ref }}
fetch-depth
:
'
0'
-
name
:
Setup Scala
uses
:
actions/setup-java@v3.
11
.0
uses
:
actions/setup-java@v3.
9
.0
with
:
distribution
:
temurin
java-version
:
17
...
...
example/src/main/scala/example/ApiError.scala
浏览文件 @
3792875d
...
...
@@ -23,7 +23,7 @@ import scala.util.control.NoStackTrace
sealed
trait
ApiError
extends
NoStackTrace
{
self
=>
import
ApiError._
final
def
to
Response
:
Response
=
final
def
as
Response
:
Response
=
self
match
{
case
CorruptedData
|
GithubUnreachable
=>
Response
.
fromHttpError
(
HttpError
.
InternalServerError
())
case
CacheMiss
(
key
)
=>
Response
.
fromHttpError
(
HttpError
.
NotFound
((
Path
.
empty
/
key
).
encode
))
...
...
example/src/main/scala/example/api/Api.scala
浏览文件 @
3792875d
...
...
@@ -26,7 +26,7 @@ object Api {
Http
.
collectZIO
{
case
Method
.
GET
->
!!
/
"repositories"
/
owner
/
name
/
"contributors"
=>
ZIO
.
serviceWithZIO
[
ContributorsCache
](
_
.
fetchAll
(
Repository
(
Owner
(
owner
),
Name
(
name
))))
.
mapBoth
(
_
.
to
Response
,
r
=>
Response
.
json
(
r
.
toJson
))
.
mapBoth
(
_
.
as
Response
,
r
=>
Response
.
json
(
r
.
toJson
))
.
merge
}
}
redis/src/main/scala/zio/redis/ClusterExecutor.scala
浏览文件 @
3792875d
...
...
@@ -47,7 +47,7 @@ final class ClusterExecutor private (
def
executeSafe
(
keySlot
:
Slot
)
=
{
val
recover
=
execute
(
keySlot
).
flatMap
{
case
e
:
RespValue.Error
=>
ZIO
.
fail
(
e
.
to
RedisError
)
case
e
:
RespValue.Error
=>
ZIO
.
fail
(
e
.
as
RedisError
)
case
success
=>
ZIO
.
succeed
(
success
)
}.
catchSome
{
case
e
:
RedisError.Ask
=>
executeAsk
(
e
.
address
)
...
...
redis/src/main/scala/zio/redis/Output.scala
浏览文件 @
3792875d
...
...
@@ -32,7 +32,7 @@ sealed trait Output[+A] { self =>
private
[
redis
]
final
def
unsafeDecode
(
respValue
:
RespValue
)
:
A
=
respValue
match
{
case
error
:
RespValue.Error
=>
throw
error
.
to
RedisError
case
error
:
RespValue.Error
=>
throw
error
.
as
RedisError
case
success
=>
tryDecode
(
success
)
}
}
...
...
redis/src/main/scala/zio/redis/internal/RespCommandArgument.scala
浏览文件 @
3792875d
...
...
@@ -45,13 +45,13 @@ private[redis] object RespCommandArgument {
}
final
case
class
Key
(
bytes
:
Chunk
[
Byte
])
extends
RespCommandArgument
{
lazy
val
value
:
RespValue.BulkString
=
RespValue
.
BulkString
(
bytes
)
lazy
val
asCRC16
:
Int
=
{
val
betweenBraces
=
bytes
.
dropWhile
(
b
=>
b
!=
'{'
).
drop
(
1
).
takeWhile
(
b
=>
b
!=
'}'
)
val
key
=
if
(
betweenBraces
.
isEmpty
)
bytes
else
betweenBraces
CRC16
.
get
(
key
)
}
lazy
val
value
:
RespValue.BulkString
=
RespValue
.
BulkString
(
bytes
)
}
object
Key
{
...
...
redis/src/main/scala/zio/redis/internal/RespValue.scala
浏览文件 @
3792875d
...
...
@@ -51,7 +51,7 @@ private[redis] object RespValue {
final
case
class
SimpleString
(
value
:
String
)
extends
RespValue
final
case
class
Error
(
value
:
String
)
extends
RespValue
{
def
to
RedisError
:
RedisError
=
def
as
RedisError
:
RedisError
=
if
(
value
.
startsWith
(
"ERR"
))
RedisError
.
ProtocolError
(
value
.
drop
(
3
).
trim
)
else
if
(
value
.
startsWith
(
"WRONGTYPE"
))
RedisError
.
WrongType
(
value
.
drop
(
9
).
trim
)
else
if
(
value
.
startsWith
(
"BUSYGROUP"
))
RedisError
.
BusyGroup
(
value
.
drop
(
9
).
trim
)
...
...
@@ -72,9 +72,9 @@ private[redis] object RespValue {
final
case
class
Integer
(
value
:
Long
)
extends
RespValue
final
case
class
BulkString
(
value
:
Chunk
[
Byte
])
extends
RespValue
{
private
[
redis
]
def
asString
:
String
=
decode
(
value
)
def
asLong
:
Long
=
internal
.
unsafeReadLong
(
asString
,
0
)
private
[
redis
]
def
asLong
:
Long
=
internal
.
unsafeReadLong
(
asString
,
0
)
def
asString
:
String
=
decode
(
value
)
}
final
case
class
Array
(
values
:
Chunk
[
RespValue
])
extends
RespValue
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录