redis

package
v0.0.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const KeepTTL = redis.KeepTTL

Variables

View Source
var File_client_redis_conf_proto protoreflect.FileDescriptor

Functions

func ErrSpanLost

func ErrSpanLost(format string, a ...interface{}) error

func IsErrSpanLost

func IsErrSpanLost(err error) bool

func IsNil

func IsNil(err error) bool

func IsRedisNil

func IsRedisNil(err error) bool

func NewRedisTracingHook

func NewRedisTracingHook(debug bool) *tracingHook

func NewSpanContext

func NewSpanContext(ctx context.Context, s trace.Span) context.Context

func RedisNil

func RedisNil(err redis.Error) error

RedisNil 没有值

func SpanFromContext

func SpanFromContext(ctx context.Context) (s trace.Span, ok bool)

SpanFromContext returns the Transport value stored in ctx, if any.

Types

type Client

type Client struct {
	redis.Client
}

func New

func New(c *Conf) *Client

type ClusterClient added in v0.0.32

type ClusterClient struct {
	redis.ClusterClient
}

func NewCluster added in v0.0.32

func NewCluster(c *Conf) *ClusterClient

type Conf

type Conf struct {

	// string network = 1;
	Addrs         []string             `protobuf:"bytes,2,rep,name=addrs,proto3" json:"addrs,omitempty"`
	ReadTimeout   *durationpb.Duration `protobuf:"bytes,3,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"`
	WriteTimeout  *durationpb.Duration `protobuf:"bytes,4,opt,name=write_timeout,json=writeTimeout,proto3" json:"write_timeout,omitempty"`
	DialTimeout   *durationpb.Duration `protobuf:"bytes,5,opt,name=dial_timeout,json=dialTimeout,proto3" json:"dial_timeout,omitempty"`
	ExpireTimeout *durationpb.Duration `protobuf:"bytes,6,opt,name=expire_timeout,json=expireTimeout,proto3" json:"expire_timeout,omitempty"`
	Username      string               `protobuf:"bytes,7,opt,name=username,proto3" json:"username,omitempty"`
	Password      string               `protobuf:"bytes,8,opt,name=password,proto3" json:"password,omitempty"`
	Db            int32                `protobuf:"varint,9,opt,name=db,proto3" json:"db,omitempty"`
	Tls           *Tls                 `protobuf:"bytes,10,opt,name=tls,proto3" json:"tls,omitempty"`
	Debug         bool                 `protobuf:"varint,11,opt,name=debug,proto3" json:"debug,omitempty"`
	// contains filtered or unexported fields
}

func (*Conf) Descriptor deprecated

func (*Conf) Descriptor() ([]byte, []int)

Deprecated: Use Conf.ProtoReflect.Descriptor instead.

func (*Conf) GetAddrs added in v0.0.32

func (x *Conf) GetAddrs() []string

func (*Conf) GetDb

func (x *Conf) GetDb() int32

func (*Conf) GetDebug added in v0.0.19

func (x *Conf) GetDebug() bool

func (*Conf) GetDialTimeout

func (x *Conf) GetDialTimeout() *durationpb.Duration

func (*Conf) GetExpireTimeout

func (x *Conf) GetExpireTimeout() *durationpb.Duration

func (*Conf) GetPassword

func (x *Conf) GetPassword() string

func (*Conf) GetReadTimeout

func (x *Conf) GetReadTimeout() *durationpb.Duration

func (*Conf) GetTls added in v0.0.13

func (x *Conf) GetTls() *Tls

func (*Conf) GetUsername

func (x *Conf) GetUsername() string

func (*Conf) GetWriteTimeout

func (x *Conf) GetWriteTimeout() *durationpb.Duration

func (*Conf) ProtoMessage

func (*Conf) ProtoMessage()

func (*Conf) ProtoReflect

func (x *Conf) ProtoReflect() protoreflect.Message

func (*Conf) Reset

func (x *Conf) Reset()

func (*Conf) String

func (x *Conf) String() string

func (*Conf) Validate

func (m *Conf) Validate() error

Validate checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Conf) ValidateAll added in v0.0.8

func (m *Conf) ValidateAll() error

ValidateAll checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ConfMultiError, or nil if none found.

type ConfMultiError added in v0.0.8

type ConfMultiError []error

ConfMultiError is an error wrapping multiple validation errors returned by Conf.ValidateAll() if the designated constraints aren't met.

func (ConfMultiError) AllErrors added in v0.0.8

func (m ConfMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ConfMultiError) Error added in v0.0.8

func (m ConfMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ConfValidationError

type ConfValidationError struct {
	// contains filtered or unexported fields
}

ConfValidationError is the validation error returned by Conf.Validate if the designated constraints aren't met.

func (ConfValidationError) Cause

func (e ConfValidationError) Cause() error

Cause function returns cause value.

func (ConfValidationError) Error

func (e ConfValidationError) Error() string

Error satisfies the builtin error interface

func (ConfValidationError) ErrorName

func (e ConfValidationError) ErrorName() string

ErrorName returns error name.

func (ConfValidationError) Field

func (e ConfValidationError) Field() string

Field function returns field value.

func (ConfValidationError) Key

func (e ConfValidationError) Key() bool

Key function returns key value.

func (ConfValidationError) Reason

func (e ConfValidationError) Reason() string

Reason function returns reason value.

type Logger added in v0.0.19

type Logger struct {
	// contains filtered or unexported fields
}

func NewLogger added in v0.0.19

func NewLogger(core zapcore.Core) *Logger

func (Logger) Enabled added in v0.0.19

func (l Logger) Enabled(lvl zapcore.Level) bool

func (Logger) Printf added in v0.0.19

func (l Logger) Printf(ctx context.Context, format string, v ...interface{})

type Pipeliner

type Pipeliner = redis.Pipeliner

type RedisTextMapCarrier

type RedisTextMapCarrier struct {
}

func (*RedisTextMapCarrier) Get

func (carrier *RedisTextMapCarrier) Get(key string) string

Get returns the value associated with the passed key.

func (*RedisTextMapCarrier) Keys

func (carrier *RedisTextMapCarrier) Keys() []string

Keys lists the keys stored in this carrier.

func (*RedisTextMapCarrier) Set

func (carrier *RedisTextMapCarrier) Set(key string, value string)

Set stores the key-value pair.

type Script

type Script = redis.Script

func NewScript

func NewScript(src string) *Script

type StringStringMapCmd

type StringStringMapCmd = redis.StringStringMapCmd

type Tls added in v0.0.13

type Tls struct {
	InsecureSkipVerify bool `protobuf:"varint,1,opt,name=insecureSkipVerify,proto3" json:"insecureSkipVerify,omitempty"`
	// contains filtered or unexported fields
}

func (*Tls) Descriptor deprecated added in v0.0.13

func (*Tls) Descriptor() ([]byte, []int)

Deprecated: Use Tls.ProtoReflect.Descriptor instead.

func (*Tls) GetInsecureSkipVerify added in v0.0.13

func (x *Tls) GetInsecureSkipVerify() bool

func (*Tls) ProtoMessage added in v0.0.13

func (*Tls) ProtoMessage()

func (*Tls) ProtoReflect added in v0.0.13

func (x *Tls) ProtoReflect() protoreflect.Message

func (*Tls) Reset added in v0.0.13

func (x *Tls) Reset()

func (*Tls) String added in v0.0.13

func (x *Tls) String() string

func (*Tls) Validate added in v0.0.13

func (m *Tls) Validate() error

Validate checks the field values on Tls with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Tls) ValidateAll added in v0.0.13

func (m *Tls) ValidateAll() error

ValidateAll checks the field values on Tls with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in TlsMultiError, or nil if none found.

type TlsMultiError added in v0.0.13

type TlsMultiError []error

TlsMultiError is an error wrapping multiple validation errors returned by Tls.ValidateAll() if the designated constraints aren't met.

func (TlsMultiError) AllErrors added in v0.0.13

func (m TlsMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (TlsMultiError) Error added in v0.0.13

func (m TlsMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type TlsValidationError added in v0.0.13

type TlsValidationError struct {
	// contains filtered or unexported fields
}

TlsValidationError is the validation error returned by Tls.Validate if the designated constraints aren't met.

func (TlsValidationError) Cause added in v0.0.13

func (e TlsValidationError) Cause() error

Cause function returns cause value.

func (TlsValidationError) Error added in v0.0.13

func (e TlsValidationError) Error() string

Error satisfies the builtin error interface

func (TlsValidationError) ErrorName added in v0.0.13

func (e TlsValidationError) ErrorName() string

ErrorName returns error name.

func (TlsValidationError) Field added in v0.0.13

func (e TlsValidationError) Field() string

Field function returns field value.

func (TlsValidationError) Key added in v0.0.13

func (e TlsValidationError) Key() bool

Key function returns key value.

func (TlsValidationError) Reason added in v0.0.13

func (e TlsValidationError) Reason() string

Reason function returns reason value.

type XAddArgs added in v0.0.39

type XAddArgs = redis.XAddArgs

type Z

type Z = redis.Z

type ZAddArgs

type ZAddArgs = redis.ZAddArgs

type ZRangeBy

type ZRangeBy = redis.ZRangeBy

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL