redis_pack

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 4 Imported by: 0

README

redis的使用更简单

说明

基于redigo的封装,写入好配置文件后,在任何地方随时调用,使用起来更简单,代码更优雅 支持和redigo同时使用

安装

go get -u -v github.com/chensanle/redis-pack

使用

package main

import (
	"fmt"

	"github.com/chensanle/redis-pack"
)

func init() {
    redis_pack.InitPool("", "")
}

func main() {
	err := redis_pack.RedigoConn.String.Set("1", 2, 10).Error()
	if err != nil {
		fmt.Println(err)
		return
	}
	v, err := redis_pack.RedigoConn.String.Get("1").Int64()
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(v)
}

License

The MIT License.

source https://github.com/newgoo/redigo-pack

Documentation

Overview

基于redigo的封装

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorConfig error = fmt.Errorf("请先初始化redis配置")
)
View Source
var NilError = redis.ErrNil
View Source
var RedigoConn = new(RedigoPack)

Functions

func NewConnectionByPool

func NewConnectionByPool(pool2 *redis.Pool) error

func NewConnectionWithFile

func NewConnectionWithFile(addr, password string) error

Types

type RedigoPack

type RedigoPack struct {
	String stringRds
	List   listRds
	Hash   hashRds
	Key    keyRds
	Set    setRds
	ZSet   zSetRds
	Bit    bitRds
	Db     dbRds
}

type Reply

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

func (*Reply) Bool

func (r *Reply) Bool() (bool, error)

func (*Reply) ByteSlices

func (r *Reply) ByteSlices() ([][]byte, error)

func (*Reply) Bytes

func (r *Reply) Bytes() ([]byte, error)

func (*Reply) Error

func (r *Reply) Error() error

func (*Reply) Float64 added in v1.0.1

func (r *Reply) Float64() (float64, error)

func (*Reply) Float64s

func (r *Reply) Float64s() ([]float64, error)

func (*Reply) Int

func (r *Reply) Int() (int, error)

func (*Reply) Int64

func (r *Reply) Int64() (int64, error)

func (*Reply) Int64Map

func (r *Reply) Int64Map() (map[string]int64, error)

func (*Reply) Int64s

func (r *Reply) Int64s() ([]int64, error)

func (*Reply) IntMap

func (r *Reply) IntMap() (map[string]int, error)

func (*Reply) Ints

func (r *Reply) Ints() ([]int, error)

func (*Reply) Positions

func (r *Reply) Positions() ([]*[2]float64, error)

func (*Reply) Result

func (r *Reply) Result() (interface{}, error)

func (*Reply) ScanStruct

func (r *Reply) ScanStruct(obj interface{}) error

obj为一个指针对象

func (*Reply) String

func (r *Reply) String() (string, error)

func (*Reply) StringMap

func (r *Reply) StringMap() (map[string]string, error)

func (*Reply) Strings

func (r *Reply) Strings() ([]string, error)

func (*Reply) Uint64

func (r *Reply) Uint64() (uint64, error)

func (*Reply) Values

func (r *Reply) Values() ([]interface{}, error)

Jump to

Keyboard shortcuts

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