driver

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileStat

func FileStat(file string) string

verify file isExist

func InitConfToml added in v0.1.9

func InitConfToml(file string, ConfMap interface{})

init toml

func Loginit

func Loginit(name string) *log.Logger

init run log of service

Types

type Err added in v0.1.3

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

type MysqlConnConf

type MysqlConnConf struct {
	DriverName      string `toml:"driver_name"`
	Host            string `toml:"host"`
	Database        string `toml:"database"`
	User            string `toml:"user"`
	Password        string `toml:"password"`
	Port            uint   `toml:"port"`
	MaxIdleConn     int    `toml:"max_idle_conn"`      //用于设置闲置的连接数。
	MaxOpenConn     int    `toml:"max_open_conn"`      //用于设置最大打开的连接数,默认值为0表示不限制
	ConnMaxIdleTime int    `toml:"conn_max_idle_time"` //链接空闲时长 超出杀死
	ConnMaxLifetime int    `toml:"conn_max_life_time"` //链接复用时长
	SqlLog          int    `toml:"sql_log"`            //日志级别 1 静默 2 错误信息 3 警告信息 4 所有信息
}

func (*MysqlConnConf) GetPool

func (conf *MysqlConnConf) GetPool(tomlName string) *gorm.DB

get database by name

func (*MysqlConnConf) InitMysqlToml

func (conf *MysqlConnConf) InitMysqlToml(file string)

type MysqlConnConfMap

type MysqlConnConfMap struct {
	Mysql map[string]*MysqlConnConf `toml:"mysql"`
}
var MysqlConfMapList MysqlConnConfMap

type RedisConnConf

type RedisConnConf struct {
	Host        string
	Password    string
	Port        uint
	MaxIdleConn int
	MaxOpenConn int
}

redis

func (*RedisConnConf) GetPool

func (redisConf *RedisConnConf) GetPool(tomlName string) *redis.Pool

get conn pool

func (*RedisConnConf) InitRedisToml

func (redisConf *RedisConnConf) InitRedisToml(file string)

init toml

func (*RedisConnConf) RedisInit

func (redisConf *RedisConnConf) RedisInit() *redis.Pool

open conn

type RedisConnConfMap

type RedisConnConfMap struct {
	Redis map[string]*RedisConnConf `toml:"redis"`
}

conn list

var RedisConfMap RedisConnConfMap

type RedisType

type RedisType struct {
	Db   interface{}
	Conn *redis.Pool
}

redis struct class struct

func (RedisType) BrPop added in v0.2.0

func (r RedisType) BrPop(k string, timeout int) (val string, err error)

阻塞取出 BRPOP BLPOP 通过push写入值

func (RedisType) Del

func (r RedisType) Del(k interface{}) (err error)

Del

func (RedisType) Get

func (r RedisType) Get(k interface{}) (value string, err error)

Get

func (RedisType) HDel

func (r RedisType) HDel(name, k interface{}) (err error)

HDel 删除hName表里的k下表数据

func (RedisType) HGet

func (r RedisType) HGet(name, k interface{}) (value interface{}, err error)

HGet

func (RedisType) HGetAll

func (r RedisType) HGetAll(name interface{}) (value map[string]string, err error)

HGetAll

func (RedisType) HKeys

func (r RedisType) HKeys(hName interface{}) (value []string, err error)

HKeys get all list by hashName

func (RedisType) HSet

func (r RedisType) HSet(name, k, v interface{}) (err error)

HSet

func (RedisType) IncrBy

func (r RedisType) IncrBy(k string, v interface{}) (reply interface{}, err error)

func (RedisType) LPop

func (r RedisType) LPop(k string) (reply string, err error)

func (RedisType) LPush

func (r RedisType) LPush(k string, v interface{}) (err error)

func (RedisType) LRang

func (r RedisType) LRang(k string) (reply []int, err error)

range

func (RedisType) LRem

func (r RedisType) LRem(k string, v interface{}) (err error)

删除

func (RedisType) RPop

func (r RedisType) RPop(k string) (reply string, err error)

func (RedisType) RPush

func (r RedisType) RPush(k string, v interface{}) (err error)

func (RedisType) Set

func (r RedisType) Set(k, v interface{}, expire ...int) (err error)

Jump to

Keyboard shortcuts

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