Version: v3.1.0-rc.1+incompatible Latest Latest

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

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 9 Imported by: 0




This section is empty.


This section is empty.


func NewFromConfig

func NewFromConfig(cfg RedisConfig) (*redis.Client, error)

func NewRedis

func NewRedis(host, port, usr, pwd, database string) (storage.DI, error)


type Redis

type Redis struct {
	// contains filtered or unexported fields

func (*Redis) AddColumn

func (r *Redis) AddColumn(tableName string, column *storage.Column) error

新加字段, 表名,字段名,字段类型, 附加描述(是否为空, 默认值)

func (*Redis) Close

func (r *Redis) Close()

Close close session

func (*Redis) CreateTable

func (r *Redis) CreateTable(sql string) error

func (*Redis) DelByCondition

func (r *Redis) DelByCondition(cName string, delselector interface{}) error

func (*Redis) DropColumn

func (r *Redis) DropColumn(tableName, field string) error

func (*Redis) DropTable

func (r *Redis) DropTable(tableName string) error

func (*Redis) ExecSql

func (r *Redis) ExecSql(cmd interface{}) error

执行原始的sql语句,并不会返回数据, 只会是否执行出错

func (*Redis) GetCntByCondition

func (r *Redis) GetCntByCondition(cName string, selector interface{}) (cnt int, err error)

func (*Redis) GetDBName

func (m *Redis) GetDBName() string

func (*Redis) GetIncID

func (m *Redis) GetIncID(cName string) (int64, error)

func (*Redis) GetMutilByCondition

func (r *Redis) GetMutilByCondition(cName string, fields []string, selector, results interface{}, sort string, skip, limit int) error

func (*Redis) GetOneByCondition

func (r *Redis) GetOneByCondition(cName string, fields []string, selector, results interface{}) error

func (*Redis) GetSession

func (r *Redis) GetSession() interface{}


func (*Redis) GetType

func (r *Redis) GetType() string

GetType 获取操作db的类

func (*Redis) HasFields

func (r *Redis) HasFields(tableName, field string) (bool, error)

func (*Redis) HasTable

func (r *Redis) HasTable(tableName string) (bool, error)


func (*Redis) Index

func (r *Redis) Index(tableName string, index *storage.Index) error

func (*Redis) Insert

func (r *Redis) Insert(cName string, data interface{}) (int, error)

func (*Redis) InsertMuti

func (r *Redis) InsertMuti(cName string, data ...interface{}) error

func (*Redis) IsDuplicateErr

func (r *Redis) IsDuplicateErr(err error) bool

IsDuplicateErr returns whether err is duplicate error

func (*Redis) IsNotFoundErr

func (r *Redis) IsNotFoundErr(err error) bool

IsNotFoundErr returns whether err is not found error

func (*Redis) ModifyColumn

func (r *Redis) ModifyColumn(tableName, oldName, newColumn string) error

func (*Redis) Open

func (r *Redis) Open() error

open con

func (*Redis) Ping

func (m *Redis) Ping() error

Ping will ping the db server

func (*Redis) UpdateByCondition

func (r *Redis) UpdateByCondition(cName string, oldobj, newobj interface{}) error

type RedisConfig

type RedisConfig struct {
	Address    string
	User       string
	Password   string
	Database   string
	Port       string
	MasterName string

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL