예제 #1
0
파일: proto.go 프로젝트: ckeyer/go-ci
	"strconv"

	"gopkg.in/redis.v4/internal/errors"
)

const (
	ErrorReply  = '-'
	StatusReply = '+'
	IntReply    = ':'
	StringReply = '$'
	ArrayReply  = '*'
)

const defaultBufSize = 4096

var errScanNil = errors.RedisError("redis: Scan(nil)")

func Scan(b []byte, val interface{}) error {
	switch v := val.(type) {
	case nil:
		return errScanNil
	case *string:
		*v = string(b)
		return nil
	case *[]byte:
		*v = b
		return nil
	case *int:
		var err error
		*v, err = strconv.Atoi(string(b))
		return err
예제 #2
0
파일: reader.go 프로젝트: ckeyer/go-ci
func parseErrorValue(line []byte) error {
	return ierrors.RedisError(string(line[1:]))
}
예제 #3
0
파일: tx.go 프로젝트: ovh/tat
package redis

import (
	"errors"
	"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
// http://redis.io/topics/transactions. It's NOT safe for concurrent use
// by multiple goroutines, because Exec resets list of watched keys.
// If you don't need WATCH it is better to use Pipeline.
type Tx struct {
	cmdable
	statefulCmdable
	baseClient

	cmds   []Cmder
	closed bool
}

var _ BaseCmdable = (*Tx)(nil)