1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Create raw output

This commit is contained in:
ofekshenawa
2023-10-09 11:52:59 +03:00
parent c6fe509f4a
commit e9b6d43c11
7 changed files with 196 additions and 175 deletions

View File

@ -64,14 +64,17 @@ func (cn *Conn) RemoteAddr() net.Addr {
}
func (cn *Conn) WithReader(
ctx context.Context, timeout time.Duration, fn func(rd *proto.Reader) error,
ctx context.Context, timeout time.Duration, fn []func(rd *proto.Reader) error,
) error {
if timeout >= 0 {
if err := cn.netConn.SetReadDeadline(cn.deadline(ctx, timeout)); err != nil {
return err
}
}
return fn(cn.rd)
for _, f := range fn {
f(cn.rd)
}
return nil
}
func (cn *Conn) WithWriter(