Documentation ¶
Index ¶
- Constants
- func Delete(tags ...string) (bool, float64, error)
- func GetKeys() ([]interface{}, float64, error)
- func GetUsers() ([]string, float64, error)
- func NewClient(params map[string]interface{})
- func PipeAll(tag string) (interface{}, float64, error)
- func PipeLength(tag string) (int64, float64, error)
- func PipePull(tag, ptype string) (int64, interface{}, float64, error)
- func PipePush(key string, value interface{}) (int64, float64, error)
- func Read(tags ...string) (interface{}, float64, error)
- func SelfDecrease(tag string) (int64, float64, error)
- func SelfIncrease(tag string) (int64, float64, error)
- func ServerTime() (time.Time, float64, error)
- func Write(key string, value interface{}) (interface{}, float64, error)
- func Writes(kvs map[string]interface{}) (interface{}, float64, error)
- type ConnHandel
- type ConnPool
- func (p *ConnPool) Delete(tags ...string) (bool, float64, error)
- func (p *ConnPool) GetKeys() ([]interface{}, float64, error)
- func (p *ConnPool) GetUsers() ([]string, float64, error)
- func (p *ConnPool) PipeAll(tag string) (interface{}, float64, error)
- func (p *ConnPool) PipeLength(tag string) (int64, float64, error)
- func (p *ConnPool) PipePull(tag, ptype string) (int64, interface{}, float64, error)
- func (p *ConnPool) PipePush(key string, value interface{}) (int64, float64, error)
- func (p *ConnPool) Read(tags ...string) (interface{}, float64, error)
- func (p *ConnPool) Request(funcCode byte, msg interface{}) (*RespMsg, float64, error)
- func (p *ConnPool) SelfDecrease(tag string) (int64, float64, error)
- func (p *ConnPool) SelfIncrease(tag string) (int64, float64, error)
- func (p *ConnPool) ServerTime() (time.Time, float64, error)
- func (p *ConnPool) Write(key string, val interface{}) (interface{}, float64, error)
- func (p *ConnPool) Writes(kvs map[string]interface{}) (interface{}, float64, error)
- type RespMsg
- type UserMsg
Constants ¶
View Source
const (
VERSION = "v1.0.0" //版本号
)
Variables ¶
This section is empty.
Functions ¶
func GetKeys ¶
获取所有的非系统KEYS
请求参数: 无
反回参数:
interface{} : 标签所对应的数据,单个标签时为data,多个标签时为[]{Ok:bool,Msg:string,Data:interface{}} float64 : 执行耗时,单位秒 error : 错误信息
func GetUsers ¶
获取所有的用户名列表
请求参数: 无
反回参数:
interface{} : 标签所对应的数据,单个标签时为data,多个标签时为[]{Ok:bool,Msg:string,Data:interface{}} float64 : 执行耗时,单位秒 error : 错误信息
func NewClient ¶
func NewClient(params map[string]interface{})
新建内存数据库的连接池:
{ "hostname":"字符串,输入,服务器的网络地址或机器名,默认值 127.0.0.1" "username":"用户名,字符串,缺省值 admin" "password":"密码,字符串,缺省值 admin123" "langtype":"语言类型,字符串,缺省值 zh-CN" "port" :"端口号,整型,缺省值 9646" "size" :"连接池大小,最小1,最大50" "timeout" :"超时时间(毫秒),默认值 3000" "max_sec" :"最大租借时间(秒),默认值 3600" }
func PipeAll ¶
从管道中拉取所有数据
请求参数: tag string : 标签名
反回参数:
interface{} : 获取到的数据 float64 : 执行耗时,单位秒 error : 错误信息
func PipeLength ¶
获取管道当前的长度
请求参数: tag string : 标签名
反回参数:
int64 : 当前管道长度 float64 : 执行耗时,单位秒 error : 错误信息
func PipePull ¶
从管道中拉取数据
请求参数: tag string : 标签名 ptype string : 拉取方式, "FIFO"、"LILO"或"FILO"、"LIFO"(不区分大小写)
反回参数:
int64 : 剩余长度 interface{} : 获取到的数据 float64 : 执行耗时,单位秒
error : 错误信息
func PipePush ¶
压入管道
请求参数: key string 标签名 value interface{} 数值
反回参数:
int64: 当前管道长度 float64 : 执行耗时,单位秒 error : 错误信息
func Read ¶
读取标签
请求参数: tags ...string : 标签名
反回参数:
interface{} : 标签所对应的数据,单个标签时为data,多个标签时为[]{Ok:bool,Msg:string,Data:interface{}} float64 : 执行耗时,单位秒 error : 错误信息
Types ¶
type ConnHandel ¶
type ConnHandel struct { Id int64 //序号 Conn net.Conn //通讯连接 ConnServer bool //与服务器已建立连接 Logged bool //是否已登录标志 Working bool //工作中 TxBytes int64 //发送字节数 RxBytes int64 //接收字节数 TxTimes int64 //发送次数 RxTimes int64 //接收次数 WorkeAt time.Time //本次开始工作的时间 LoginAt time.Time //登录时间 CreatedAt time.Time //创建时间 LoseServerAt time.Time //最近一次连接不上服务器的时间 // contains filtered or unexported fields }
一个通讯连接
type ConnPool ¶
type ConnPool struct { WorkerChan chan int //工作通道 ReqChan chan int //请求队列 ConnChan chan *ConnHandel //连接句柄队列 Conns []*ConnHandel //连接池 Version string //版本号 // contains filtered or unexported fields }
连接工作池结构
func NewConnPool ¶
******************************************************************************
-功能:实例化工作池 -参数: [hostname] 字符串,输入,服务器的网络地址或机器名,默认值 127.0.0.1 [username] 用户名,字符串,缺省值 admin [password] 密码,字符串,缺省值 admin123 [langtype] 语言类型,字符串,缺省值 zh-CN [port] 端口号,整型,缺省值 9646 [size] 连接池大小,最小1,最大50 [timeout] 超时时间(毫秒),默认值 3000 [max_sec] 最大租借时间(秒),默认值 3600
- 输出:*ConnPool 连接池指针 [error] 创建句柄连接池时候的错误信息
- 备注:
- 时间: 2020年6月27日
******************************************************************************
func (*ConnPool) Delete ¶
删除标签
请求参数: tags ...string : 标签名
反回参数:
bool : 删除的结果 float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) GetKeys ¶
获取所有的非系统KEYS
请求参数: 无
反回参数:
interface{} : 标签所对应的数据,单个标签时为data,多个标签时为[]{Ok:bool,Msg:string,Data:interface{}} float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) GetUsers ¶
获取所有的用户名列表
请求参数: 无
反回参数:
interface{} : 标签所对应的数据,单个标签时为data,多个标签时为[]{Ok:bool,Msg:string,Data:interface{}} float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) PipeAll ¶
从管道中拉取所有数据 请求参数:
tag string : 标签名
反回参数:
interface{} : 获取到的数据 float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) PipeLength ¶
获取管道当前的长度
请求参数: tag string : 标签名
反回参数:
int64 : 当前管道长度 float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) PipePull ¶
从管道中拉取数据
请求参数: tag string : 标签名 ptype string : 拉取方式, "FIFO"、"LILO"或"FILO"、"LIFO"(不区分大小写)
反回参数:
int64 : 剩余长度 interface{} : 获取到的数据 float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) PipePush ¶
压入管道
请求参数: key string 标签名 value interface{} 数值
反回参数:
int64: 当前管道长度 float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) Read ¶
读取标签
请求参数: tags ...string : 标签名
反回参数:
interface{} : 标签所对应的数据,单个标签时为data,多个标签时为[]{Ok:bool,Msg:string,Data:interface{}} float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) Request ¶
自由请求接口
请求参数: funcCode byte : 功能码 msg interface{} : 符合json结构和功能码要求的信息
反回参数:
interface{} : 服务器返回的数据 float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) SelfDecrease ¶
标签自减
请求参数: tag string : 标签名
反回参数:
int64 : 当前值 float64 : 执行耗时,单位秒 error : 错误信息
func (*ConnPool) SelfIncrease ¶
标签自增
请求参数: tag string : 标签名
反回参数:
int64 : 当前值 float64 : 执行耗时,单位秒 error : 错误信息
Click to show internal directories.
Click to hide internal directories.