mirror of https://github.com/tidwall/redcon.git
fix: []byte nil resp
This commit is contained in:
parent
9f71787fcd
commit
77c37f99e0
5
resp.go
5
resp.go
|
@ -556,6 +556,7 @@ type Marshaler interface {
|
|||
}
|
||||
|
||||
// AppendAny appends any type to valid Redis type.
|
||||
//
|
||||
// nil -> null
|
||||
// error -> error (adds "ERR " when first word is not uppercase)
|
||||
// string -> bulk-string
|
||||
|
@ -583,7 +584,11 @@ func AppendAny(b []byte, v interface{}) []byte {
|
|||
case string:
|
||||
b = AppendBulkString(b, v)
|
||||
case []byte:
|
||||
if v == nil {
|
||||
b = AppendNull(b)
|
||||
} else {
|
||||
b = AppendBulk(b, v)
|
||||
}
|
||||
case bool:
|
||||
if v {
|
||||
b = AppendBulkString(b, "1")
|
||||
|
|
Loading…
Reference in New Issue