driver

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 9 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表示不限制
	SqlLog      bool   `toml:"sql_log"`       //是否打印sql
}

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) 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