kredis

package
v0.0.0-...-699dfa3 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: MIT Imports: 11 Imported by: 6

Documentation

Overview

redis wrapper

refer: https://github.com/smacker/opentracing-go-redis/blob/master/otredis.go, replace redis.Client with redis.ClusterClient

Index

Constants

View Source
const (
	Success = ErrHandleResult(iota)
	NotFound
	DB_ERROR
)

Variables

This section is empty.

Functions

func GetTestRedis

func GetTestRedis() (*redis.Client, error)

func Init

func Init(cfg Config) (*redis.ClusterClient, error)

func WrapRedisClient

func WrapRedisClient(ctx context.Context, client *redis.Client) *redis.Client

WrapRedisClient adds opentracing measurements for commands and returns cloned client

func WrapRedisClusterClient

func WrapRedisClusterClient(ctx context.Context, client *redis.ClusterClient) *redis.ClusterClient

WrapRedisClient adds opentracing measurements for commands and returns cloned client

Types

type Config

type Config struct {
	Addrs        []string `yaml:"addrs"`
	DialTimeout  int64    `yaml:"dialTimeOut"`  // in ms
	ReadTimeout  int64    `yaml:"readTimeOut"`  // in ms
	WriteTimeout int64    `yaml:"writeTimeOut"` // in ms
}

type ErrHandleResult

type ErrHandleResult int

func ErrorHandleAndLog

func ErrorHandleAndLog(c *gin.Context, err error, treatNotFoundAsErr bool, desc string, key string, extra interface{}) ErrHandleResult

desc and key for log

Jump to

Keyboard shortcuts

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