コード例 #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)