sysmodule

package
v0.0.0-...-604ee51 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_EXECUTE_FUN = 10000
)
View Source
const (
	MAX_TASK_CHANNEL = 10240
)

最大redis信道任务量

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigRedis

type ConfigRedis struct {
	IP            string
	Port          string
	Password      string
	DbIndex       int
	MaxIdle       int //最大的空闲连接数,表示即使没有redis连接时依然可以保持N个空闲的连接,而不被清除,随时处于待命状态。
	MaxActive     int //最大的激活连接数,表示同时最多有N个连接
	IdleTimeout   int //最大的空闲连接等待时间,超过此时间后,空闲连接将被关闭
	SyncRouterNum int //异步执行Router数量
}

ConfigRedis 服务器配置

type DBExecute

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

type DBModule

type DBModule struct {
	service.Module

	PrintTime time.Duration
	// contains filtered or unexported fields
}

DBModule ...

func (*DBModule) AsyncExec

func (slf *DBModule) AsyncExec(call SyncDBResultExCallBack, queryHas int, query string, args ...interface{}) error

func (*DBModule) AsyncQuery

func (slf *DBModule) AsyncQuery(call SyncDBResultExCallBack, queryHas int, query string, args ...interface{}) error

func (*DBModule) Begin

func (slf *DBModule) Begin() (*Tx, error)

Begin starts a transaction.

func (*DBModule) CheckArgs

func (slf *DBModule) CheckArgs(args ...interface{}) error

func (*DBModule) Connect

func (slf *DBModule) Connect(maxConn int) error

Connect ...

func (*DBModule) Exec

func (slf *DBModule) Exec(query string, args ...interface{}) (*DBResultEx, error)

Exec ...

func (*DBModule) Init

func (slf *DBModule) Init(maxConn, executeNum int, url string, userName string, password string, dbname string) error

func (*DBModule) IsPrintTimeLog

func (slf *DBModule) IsPrintTimeLog(Time time.Duration) bool

func (*DBModule) OnInit

func (slf *DBModule) OnInit() error

func (*DBModule) OnRelease

func (slf *DBModule) OnRelease()

func (*DBModule) Query

func (slf *DBModule) Query(query string, args ...interface{}) DBResult

Query ...

func (*DBModule) QueryEx

func (slf *DBModule) QueryEx(query string, args ...interface{}) (*DataSetList, error)

func (*DBModule) RunExecuteDBCoroutine

func (slf *DBModule) RunExecuteDBCoroutine(has int)

func (*DBModule) RunPing

func (slf *DBModule) RunPing()

func (*DBModule) SetQuerySlowTime

func (slf *DBModule) SetQuerySlowTime(Time time.Duration)

func (*DBModule) SyncExec

func (slf *DBModule) SyncExec(queryHas int, query string, args ...interface{}) *SyncExecuteDBResult

SyncExec ...

func (*DBModule) SyncQuery

func (slf *DBModule) SyncQuery(queryHas int, query string, args ...interface{}) SyncQueryDBResultEx

SyncQuery ...

type DBResult

type DBResult struct {
	Err          error
	LastInsertID int64
	RowsAffected int64
	// contains filtered or unexported fields
}

DBResult ...

func (*DBResult) Close

func (slf *DBResult) Close()

Close ...

func (*DBResult) NextResult

func (slf *DBResult) NextResult() bool

NextResult ...

func (*DBResult) SetBlurMode

func (slf *DBResult) SetBlurMode(blur bool) *DBResult

SetBlurMode ...

func (*DBResult) SetSpecificTag

func (slf *DBResult) SetSpecificTag(tag string) *DBResult

SetSpecificTag ...

func (*DBResult) UnMarshal

func (slf *DBResult) UnMarshal(out interface{}) error

UnMarshal ...

type DBResultEx

type DBResultEx struct {
	LastInsertID int64
	RowsAffected int64

	RowInfo map[string][]interface{} //map[fieldname][row]sql.NullString
	// contains filtered or unexported fields
}

DBResult ...

type DataSetList

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

func (*DataSetList) UnMarshal

func (slf *DataSetList) UnMarshal(args ...interface{}) error

type ErrorMapStringBool

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

type Func

type Func func()

type HttpClientPoolModule

type HttpClientPoolModule struct {
	service.Module
	// contains filtered or unexported fields
}

func (*HttpClientPoolModule) Init

func (slf *HttpClientPoolModule) Init(maxpool int, proxyUrl string)

func (*HttpClientPoolModule) Request

func (slf *HttpClientPoolModule) Request(method string, url string, body []byte, header http.Header) HttpRespone

func (*HttpClientPoolModule) SyncRequest

func (slf *HttpClientPoolModule) SyncRequest(method string, url string, body []byte, header http.Header) SyncHttpRespone

type HttpRespone

type HttpRespone struct {
	Err        error
	Header     http.Header
	StatusCode int
	Status     string
	Body       []byte
}

type PingExecute

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

type RedisModule

type RedisModule struct {
	service.Module
	// contains filtered or unexported fields
}

func (*RedisModule) DelHash

func (slf *RedisModule) DelHash(redisKey string, hsahKey string) error

DelRedisHash ...

func (*RedisModule) DelMuchHash

func (slf *RedisModule) DelMuchHash(redisKey string, hsahKey []string) error

DelMuchRedisHash ...

func (*RedisModule) DelMuchString

func (slf *RedisModule) DelMuchString(keys []string) (map[string]bool, error)

DelMuchRedisString redis删除string类型数据 示例:DelMuchRedisString([]string{"AAAABTEST1",""AAAABTEST2})

func (*RedisModule) DelString

func (slf *RedisModule) DelString(key string) error

DelRedisString redis删除string类型数据 示例:DelRedisString("AAAABTEST1")

func (*RedisModule) EXPlREInsert

func (slf *RedisModule) EXPlREInsert(key string, TTl int) error

func (*RedisModule) ExistsKey

func (slf *RedisModule) ExistsKey(key string) (bool, error)

判断一个Key是否存在

func (*RedisModule) GetAllHashJSON

func (slf *RedisModule) GetAllHashJSON(redisKey string) (map[string]string, error)

GetRedisAllHashJSON ...

func (*RedisModule) GetHashValueByHashKeyList

func (slf *RedisModule) GetHashValueByHashKeyList(fieldKey ...interface{}) ([]string, error)

GetHashValueByHashKeyList ...

func (*RedisModule) GetHashValueByKey

func (slf *RedisModule) GetHashValueByKey(redisKey string, fieldKey string) (string, error)

GetRedisHashValueByKey ...

func (*RedisModule) GetListLen

func (slf *RedisModule) GetListLen(key string) (int, error)

获取List的长度

func (*RedisModule) GetMuchString

func (slf *RedisModule) GetMuchString(keys []string) (retMap map[string]string, err error)

GetMuchRedisString redis获取string类型数据 Pipeline实现的原理是队列,而队列的原理是先进先出 示例:GetMuchRedisString(&[]string{"AAAABTEST1", "AAAABTEST2"})

func (*RedisModule) GetMuchStringJSON

func (slf *RedisModule) GetMuchStringJSON(keys map[string]interface{}) error

GetMuchRedisStringJSON redis获取string类型数据Json Pipeline实现的原理是队列,而队列的原理是先进先出 示例:temp := make(map[string]interface{}) temp["AAAABTEST1"] = &eagleconfig.ServerConfig{} temp["AAAABTEST2"] = &eagleconfig.ServerConfig{} GetMuchRedisStringJSON(&temp)

func (*RedisModule) GetString

func (slf *RedisModule) GetString(key string) (string, error)

GetRedisString redis获取string类型数据 示例:GetRedisString("TestKey")

func (*RedisModule) GetStringJSON

func (slf *RedisModule) GetStringJSON(key string, st interface{}) error

GetRedisStringJSON redis获取string类型数据的Json 示例:GetRedisString("TestKey")

func (*RedisModule) GoDelHash

func (slf *RedisModule) GoDelHash(redisKey string, hsahKey string, err *RetError)

GoDelRedisHash

func (*RedisModule) GoDelMuchHash

func (slf *RedisModule) GoDelMuchHash(redisKey string, hsahKey []string, err *RetError)

GoDelMuchRedisHash

func (*RedisModule) GoDelMuchString

func (slf *RedisModule) GoDelMuchString(keys []string, retMapString *RetMapString)

func (*RedisModule) GoDelString

func (slf *RedisModule) GoDelString(key string, err *RetError)

func (*RedisModule) GoSetHash

func (slf *RedisModule) GoSetHash(redisKey, hashKey, value string, err *RetError)

func (*RedisModule) GoSetHashJSON

func (slf *RedisModule) GoSetHashJSON(redisKey, hsahKey string, value interface{}, err *RetError)

func (*RedisModule) GoSetListJSONLpush

func (slf *RedisModule) GoSetListJSONLpush(key string, value interface{}, retErr *RetError)

GoSetRedisListJSONLpush ...

func (*RedisModule) GoSetListJSONRpush

func (slf *RedisModule) GoSetListJSONRpush(key string, value interface{}, retErr *RetError)

GoSetRedisListJSONRpush ...

func (*RedisModule) GoSetListLpush

func (slf *RedisModule) GoSetListLpush(key, value string, err *RetError)

GoSetRedisListLpush...

func (*RedisModule) GoSetListRpush

func (slf *RedisModule) GoSetListRpush(key, value string, retErr *RetError)

GoSetListRpush ...

func (*RedisModule) GoSetMuchHashJSON

func (slf *RedisModule) GoSetMuchHashJSON(redisKey string, value map[string][]interface{}, err *RetError)

func (*RedisModule) GoSetMuchListJSONLpush

func (slf *RedisModule) GoSetMuchListJSONLpush(key string, value []interface{}, retErr *RetError)

GoSetMuchListJSONLpush ...

func (*RedisModule) GoSetMuchListJSONRpush

func (slf *RedisModule) GoSetMuchListJSONRpush(key string, value []interface{}, retErr *RetError)

GoSetMuchRedisListJSONRpush ...

func (*RedisModule) GoSetMuchListLpush

func (slf *RedisModule) GoSetMuchListLpush(key string, value []string, err *RetError)

GoSetMuchListLpush ...

func (*RedisModule) GoSetMuchListRpush

func (slf *RedisModule) GoSetMuchListRpush(key string, value []string, retErr *RetError)

GoSetMuchRedisListRpush ...

func (*RedisModule) GoSetMuchString

func (slf *RedisModule) GoSetMuchString(mapInfo map[string]string, retErr *RetError)

func (*RedisModule) GoSetMuchStringExpire

func (slf *RedisModule) GoSetMuchStringExpire(mapInfo map[string]string, expire string, err *RetError)

func (*RedisModule) GoSetString

func (slf *RedisModule) GoSetString(key, value string, err *RetError)

func (*RedisModule) GoSetStringExpire

func (slf *RedisModule) GoSetStringExpire(key, value string, expire string, err *RetError) error

func (*RedisModule) GoSetStringJSON

func (slf *RedisModule) GoSetStringJSON(key string, val interface{}, err *RetError)

func (*RedisModule) GoSetStringJSONExpire

func (slf *RedisModule) GoSetStringJSONExpire(key string, val interface{}, expire string, retErr *RetError) error

func (*RedisModule) GoTask

func (slf *RedisModule) GoTask(fc Func) error

func (*RedisModule) HincrbyHashInt

func (slf *RedisModule) HincrbyHashInt(redisKey, hashKey string, value int) error

func (*RedisModule) Init

func (slf *RedisModule) Init(redisCfg *ConfigRedis)

func (*RedisModule) Keys

func (slf *RedisModule) Keys(key string) ([]string, error)

func (*RedisModule) LRange

func (slf *RedisModule) LRange(key string, start, stop int) ([]byte, error)

func (*RedisModule) LRangeJSON

func (slf *RedisModule) LRangeJSON(key string, start, stop int, data interface{}) error

func (*RedisModule) ListPop

func (slf *RedisModule) ListPop(key string, fromLeft, block bool, timeout int) ([]byte, error)

弹出list(消息队列)数据 fromLeft表示是否从左侧弹出 block表示是否阻塞 timeout表示阻塞超时

func (*RedisModule) ListPopJson

func (slf *RedisModule) ListPopJson(key string, fromLeft, block bool, timeout int, out interface{}) error

弹出list(消息队列)数据,数据放入out fromLeft表示是否从左侧弹出 block表示是否阻塞 timeout表示阻塞超时

func (*RedisModule) Lrange

func (slf *RedisModule) Lrange(key string, start, end int) ([]string, error)

Lrange ...

func (*RedisModule) LtrimList

func (slf *RedisModule) LtrimList(key string, start, end int) error

弹出List最后条记录

func (*RedisModule) RPOPListValue

func (slf *RedisModule) RPOPListValue(key string) error

弹出List最后条记录

func (*RedisModule) RunAnsyTask

func (slf *RedisModule) RunAnsyTask()

func (*RedisModule) ScanMatchKeys

func (slf *RedisModule) ScanMatchKeys(cursorValue int, redisKey string, count int) (int, []string, error)

func (*RedisModule) SetHash

func (slf *RedisModule) SetHash(redisKey, hashKey, value string) error

SetRedisHash ... 如果 hsahKey 是哈希表中的一个新建域,并且值设置成功,返回 1 如果哈希表中域 hsahKey 已经存在且旧值已被新值覆盖,返回 0

func (*RedisModule) SetHashJSON

func (slf *RedisModule) SetHashJSON(redisKey, hsahKey string, value interface{}) error

SetRedisHashJSON ...

func (*RedisModule) SetListJSONLpush

func (slf *RedisModule) SetListJSONLpush(key string, value interface{}) error

SetRedisListJSONLpush ...

func (*RedisModule) SetListJSONRpush

func (slf *RedisModule) SetListJSONRpush(key string, value interface{}) error

SetRedisListJSONRpush ...

func (*RedisModule) SetListLpush

func (slf *RedisModule) SetListLpush(key, value string) error

SetRedisListLpush ...

func (*RedisModule) SetListRpush

func (slf *RedisModule) SetListRpush(key, value string) error

SetListRpush ...

func (*RedisModule) SetMuchHashJSON

func (slf *RedisModule) SetMuchHashJSON(redisKey string, value map[string][]interface{}) error

SetMuchRedisHashJSON ... value : hashkey -> value

func (*RedisModule) SetMuchListJSONLpush

func (slf *RedisModule) SetMuchListJSONLpush(key string, value []interface{}) error

SetMuchListJSONLpush ...

func (*RedisModule) SetMuchListJSONRpush

func (slf *RedisModule) SetMuchListJSONRpush(key string, value []interface{}) error

SetMuchRedisListJSONRpush ...

func (*RedisModule) SetMuchListLpush

func (slf *RedisModule) SetMuchListLpush(key string, value []string) error

SetMuchRedisListLpush ...

func (*RedisModule) SetMuchListRpush

func (slf *RedisModule) SetMuchListRpush(key string, value []string) error

SetMuchRedisListRpush ...

func (*RedisModule) SetMuchString

func (slf *RedisModule) SetMuchString(mapInfo map[string]string) (err error)

SetMuchRedisString redis添加多条string类型数据 示例:SetMuchRedisString(map[string]string{"Test1": "C语言", "Test2": "Go语言", "Test3": "Python", "Test4": "C++"})

func (*RedisModule) SetMuchStringExpire

func (slf *RedisModule) SetMuchStringExpire(mapInfo map[string]string, ex string) (err error)

SetMuchRedisStringSameEx redis添加多条string类型数据 具有相同的过期时间 ex过期时间 整数 示例:SetMuchRedisStringSameEx(map[string]string{"Test1": "C语言", "Test2": "Go语言", "Test3": "Python", "Test4": "C++"},"300")

func (*RedisModule) SetString

func (slf *RedisModule) SetString(key, value string) (err error)

SetRedisString redis添加string类型数据 无过期时间 示例:SetRedisString("TestKey", "Hell World!")

func (*RedisModule) SetStringExpire

func (slf *RedisModule) SetStringExpire(key, value, expire string) (err error)

SetRedisExString redis添加string类型数据 有过期时间 ex过期时间,单位秒,必须是整数 示例:SetRedisExString("TestKey", "Hell World!","60")

func (*RedisModule) SetStringJSON

func (slf *RedisModule) SetStringJSON(key string, val interface{}) (err error)

SetRedisStringJSON redis添加JSON数据 无过期时间 示例:SetRedisStringJSON("AAAABTEST1", eagleconfig.Cfg)

func (*RedisModule) SetStringJSONExpire

func (slf *RedisModule) SetStringJSONExpire(key string, val interface{}, expire string) (err error)

SetRedisExStringJSON redis添加JSON数据 有过期时间 ex过期时间,单位秒,必须是整数 示例:SetRedisStringJSON("AAAABTEST1", eagleconfig.Cfg,"60")

func (*RedisModule) TestPingRedis

func (slf *RedisModule) TestPingRedis() error

TestPingRedis 测试连接Redis

func (*RedisModule) ZADDInsert

func (slf *RedisModule) ZADDInsert(key string, score float64, Data interface{}) error

有序集合插入

func (*RedisModule) ZADDInsertJson

func (slf *RedisModule) ZADDInsertJson(key string, score float64, value interface{}) error

有序集合插入Json

func (*RedisModule) ZREM

func (slf *RedisModule) ZREM(key string, member interface{}) (int, error)

func (*RedisModule) ZREMMulti

func (slf *RedisModule) ZREMMulti(key string, member ...interface{}) (int, error)

func (*RedisModule) ZREMRANGEBYSCORE

func (slf *RedisModule) ZREMRANGEBYSCORE(key string, start, stop interface{}) error

func (*RedisModule) ZRange

func (slf *RedisModule) ZRange(key string, start, stop int, ascend bool, withScores bool) ([]byte, error)

取有序set指定排名 ascend=true表示按升序遍历 否则按降序遍历

func (*RedisModule) ZRangeByScore

func (slf *RedisModule) ZRangeByScore(key string, start, stop float64, ascend bool, withScores bool) ([]byte, error)

func (*RedisModule) ZRangeByScoreJSON

func (slf *RedisModule) ZRangeByScoreJSON(key string, start, stop float64, ascend bool, withScores bool, data interface{}) error

func (*RedisModule) ZRangeJSON

func (slf *RedisModule) ZRangeJSON(key string, start, stop int, ascend bool, withScores bool, data interface{}) error

func (*RedisModule) ZRank

func (slf *RedisModule) ZRank(key string, member interface{}, ascend bool) (int, error)

获取指定member的排名

func (*RedisModule) ZScore

func (slf *RedisModule) ZScore(key string, member interface{}) (float64, error)

获取指定member的排名

func (*RedisModule) Zcard

func (slf *RedisModule) Zcard(key string) (int, error)

获取有序集合长度

func (*RedisModule) Zremrangebyrank

func (slf *RedisModule) Zremrangebyrank(redisKey string, start, end interface{}) (int, error)

type RetError

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

func (*RetError) Get

func (slf *RetError) Get() error

type RetMapString

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

func (*RetMapString) Get

func (slf *RetMapString) Get() (error, map[string]bool)

type SyncDBResult

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

SyncDBResult ...

func (*SyncDBResult) Get

func (slf *SyncDBResult) Get(timeoutMs int) DBResult

Get ...

type SyncDBResultExCallBack

type SyncDBResultExCallBack func(dataList *DataSetList, err error)

type SyncExecuteDBResult

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

func (*SyncExecuteDBResult) Get

func (slf *SyncExecuteDBResult) Get(timeoutMs int) (*DBResultEx, error)

type SyncFun

type SyncFun func()

type SyncHttpRespone

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

func (*SyncHttpRespone) Get

func (slf *SyncHttpRespone) Get(timeoutMs int) HttpRespone

type SyncQueryDBResultEx

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

func (*SyncQueryDBResultEx) Get

func (slf *SyncQueryDBResultEx) Get(timeoutMs int) (*DataSetList, error)

type Tx

type Tx struct {
	PrintTime time.Duration
	// contains filtered or unexported fields
}

Tx ...

func (*Tx) CheckArgs

func (slf *Tx) CheckArgs(args ...interface{}) error

CheckArgs...

func (*Tx) Commit

func (slf *Tx) Commit() error

Commit commits the transaction.

func (*Tx) Exec

func (slf *Tx) Exec(query string, args ...interface{}) (*DBResultEx, error)

Exec executes a query that doesn't return rows.

func (*Tx) IsPrintTimeLog

func (slf *Tx) IsPrintTimeLog(Time time.Duration) bool

IsPrintTimeLog...

func (*Tx) Query

func (slf *Tx) Query(query string, args ...interface{}) DBResult

Query executes a query that returns rows, typically a SELECT.

func (*Tx) QueryEx

func (slf *Tx) QueryEx(query string, args ...interface{}) (*DataSetList, error)

QueryEx executes a query that return rows.

func (*Tx) Rollback

func (slf *Tx) Rollback() error

Rollback aborts the transaction.

type ZSetDataWithScore

type ZSetDataWithScore struct {
	Data  json.RawMessage `json:"data"`
	Score float64         `json:"score"`
}

Jump to

Keyboard shortcuts

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