Skip to content

Commit

Permalink
Reapply #1
Browse files Browse the repository at this point in the history
  • Loading branch information
jakule authored and greedy52 committed Oct 1, 2024
1 parent c3610cd commit c8e9f84
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ func (cmd *Cmd) readReply(rd *proto.Reader) (err error) {
return err
}

func (cmd *Cmd) ReadReply(rd *proto.Reader) (err error) {
cmd.val, err = rd.ReadReply(sliceParser)
return err
}

//------------------------------------------------------------------------------

type SliceCmd struct {
Expand Down
4 changes: 4 additions & 0 deletions internal/proto/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func (w *Writer) writeLen(n int) error {
return err
}

func (w *Writer) WriteLen(n int) error {
return w.writeLen(n)
}

func (w *Writer) WriteArg(v interface{}) error {
switch v := v.(type) {
case nil:
Expand Down
23 changes: 23 additions & 0 deletions proto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package redis

import (
"bytes"
"io"

"github.com/go-redis/redis/v9/internal/proto"
)

type Reader = proto.Reader
type Writer = proto.Writer
type RedisError = proto.RedisError

const RespArray = proto.RespArray
const RespInt = proto.RespInt

func NewReader(rd io.Reader) *Reader {
return proto.NewReader(rd)
}

func NewWriter(wr *bytes.Buffer) *Writer {
return proto.NewWriter(wr)
}

0 comments on commit c8e9f84

Please sign in to comment.