mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Make proto/parser an internal package
This commit is contained in:
9
tx.go
9
tx.go
@ -5,9 +5,14 @@ import (
|
||||
"fmt"
|
||||
|
||||
"gopkg.in/redis.v4/internal"
|
||||
ierrors "gopkg.in/redis.v4/internal/errors"
|
||||
"gopkg.in/redis.v4/internal/pool"
|
||||
"gopkg.in/redis.v4/internal/proto"
|
||||
)
|
||||
|
||||
// Redis transaction failed.
|
||||
const TxFailedErr = ierrors.RedisError("redis: transaction failed")
|
||||
|
||||
var errDiscard = errors.New("redis: Discard can be used only inside Exec")
|
||||
|
||||
// Tx implements Redis transactions as described in
|
||||
@ -166,7 +171,7 @@ func (c *Tx) execCmds(cn *pool.Conn, cmds []Cmder) error {
|
||||
}
|
||||
|
||||
// Parse number of replies.
|
||||
line, err := readLine(cn)
|
||||
line, err := cn.Rd.ReadLine()
|
||||
if err != nil {
|
||||
if err == Nil {
|
||||
err = TxFailedErr
|
||||
@ -174,7 +179,7 @@ func (c *Tx) execCmds(cn *pool.Conn, cmds []Cmder) error {
|
||||
setCmdsErr(cmds[1:len(cmds)-1], err)
|
||||
return err
|
||||
}
|
||||
if line[0] != '*' {
|
||||
if line[0] != proto.ArrayReply {
|
||||
err := fmt.Errorf("redis: expected '*', but got line %q", line)
|
||||
setCmdsErr(cmds[1:len(cmds)-1], err)
|
||||
return err
|
||||
|
Reference in New Issue
Block a user