We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c11c15 commit c6c80faCopy full SHA for c6c80fa
internal/proto/writer.go
@@ -101,16 +101,15 @@ func (w *Writer) WriteArg(v interface{}) error {
101
return w.bytes(w.numBuf)
102
case time.Duration:
103
return w.int(v.Nanoseconds())
104
+ case encoding.BinaryMarshaler:
105
+ b, err := v.MarshalBinary()
106
+ if err != nil {
107
+ return err
108
+ }
109
+ return w.bytes(b)
110
case net.IP:
111
return w.bytes(v)
112
default:
- if m, ok := v.(encoding.BinaryMarshaler); ok {
- b, err := m.MarshalBinary()
- if err != nil {
- return err
- }
- return w.bytes(b)
113
114
return fmt.Errorf(
115
"redis: can't marshal %T (implement encoding.BinaryMarshaler)", v)
116
}
0 commit comments