Documentation
¶
Index ¶
- Constants
- Variables
- func CallAction(i interface{}, c *gin.Context)
- func CallActionGet(i interface{}, c *gin.Context)
- func Cross(c *gin.Context, is_cross bool, org string)
- func Display(c *gin.Context, html []byte)
- func GetActiveCount() int
- func GetIdleCount() int
- func GetProperty(c *gin.Context) []byte
- func InitPprof(server *gin.Engine)
- func InitRedisPool(cfg *RedisConfig)
- type CKRedis
- func (m *CKRedis) Close()
- func (m *CKRedis) Count() (int, error)
- func (m *CKRedis) Do(command string, args ...interface{}) (interface{}, error)
- func (m *CKRedis) Exists(key string) bool
- func (m *CKRedis) GAdd(key string, lon string, lat string, member string) (bool, error)
- func (m *CKRedis) GDist(key string, member string, member2 string) (int, error)
- func (m *CKRedis) GPos(key string, member string) ([]interface{}, error)
- func (m *CKRedis) GRadius(key string, lon string, lat string, radius int) ([]*RedisGeo, error)
- func (m *CKRedis) Get(key string) (interface{}, error)
- func (m *CKRedis) HDel(key, field string) (bool, error)
- func (m *CKRedis) HExists(key, field string) (bool, error)
- func (m *CKRedis) HGet(key, field string) (interface{}, error)
- func (m *CKRedis) HKeys(key string) ([]interface{}, error)
- func (m *CKRedis) HLen(key string) (int, error)
- func (m *CKRedis) HMGet(key string, field ...interface{}) ([]interface{}, error)
- func (m *CKRedis) HSet(key, field string, val interface{}) (bool, error)
- func (m *CKRedis) Keys(perm string) ([]string, error)
- func (m *CKRedis) LLen(key string) (int, error)
- func (m *CKRedis) LPush(key string, value string) (int, error)
- func (m *CKRedis) LRange(key string, start int, stop int) ([]interface{}, error)
- func (m *CKRedis) LSet(key string, index int, value string) (int, error)
- func (m *CKRedis) Lock()
- func (m *CKRedis) Push(msg string) error
- func (m *CKRedis) RPop(key string) (string, error)
- func (m *CKRedis) Receive() (string, error)
- func (m *CKRedis) Remove(key ...string) error
- func (m *CKRedis) Set(key string, val interface{}, exp int) error
- func (m *CKRedis) SetDB(db_idx int)
- func (m *CKRedis) SetMessageQueueName(name string)
- func (m *CKRedis) ZAdd(key string, score int, member string) (bool, error)
- func (m *CKRedis) ZCard(key string) (int, error)
- func (m *CKRedis) ZCount(key string, min string, max string) (int, error)
- func (m *CKRedis) ZRangeByScore(key string, min string, max string, with_score bool) ([]string, error)
- func (m *CKRedis) ZRem(key, member string) (bool, error)
- type Cache
- type CacheData
- type CacheIn
- type ConnEvent
- type Connection
- func (this *Connection) Close()
- func (this *Connection) GetConnId() int
- func (this *Connection) GetReadTimeoutSec() int
- func (this *Connection) GetStatus() int
- func (this *Connection) GetUserdata() interface{}
- func (this *Connection) Send(msg []byte, cpy bool)
- func (this *Connection) SetConnId(id int)
- func (this *Connection) SetReadTimeoutSec(sec int)
- func (this *Connection) SetUserdata(ud interface{})
- type FileCache
- type GoroutinePool
- func (this *GoroutinePool) AddTask(task interface{})
- func (this *GoroutinePool) AddTaskInterface(tasks []interface{})
- func (this *GoroutinePool) AddTaskStrings(tasks []string)
- func (this *GoroutinePool) SetFinishCallback(callback func())
- func (this *GoroutinePool) Start()
- func (this *GoroutinePool) Stop()
- type IEventHandler
- type IEventQueue
- type IEventTCP
- type IStreamProtocol
- type MediaData
- type MemCache
- type MemCacheData
- type RedisConfig
- type RedisGeo
- type SysLog
- type TCPConnEvent
- type TCPConnect
- type Template
- type TemplateCon
- type Upload
- type Weixin
- func (w *Weixin) CreateQrCode(token, content string) (*WxQrCode, error)
- func (w *Weixin) CreateTempQrCode(token, content string, time_s int) (*WxQrCode, error)
- func (w *Weixin) CreateWxAppQrCode(token, scene, page string, width int) (string, error)
- func (w *Weixin) GetAccessToken() (*WxAccessToken, error)
- func (w *Weixin) GetJsapiTicket(access_token string) (*WxJsapiTicket, error)
- func (w *Weixin) GetMedia(access_token string, media_id string) (*MediaData, error)
- func (w *Weixin) GetUserAccessToken(code string) (*WxUserAccessToken, error)
- func (w *Weixin) GetUserInfo(access_token string, openid string) (*WxUserInfo, error)
- func (w *Weixin) GetUserInfoAccessToken(access_token string, openid string) (*WxUser, error)
- func (w *Weixin) Http(uri string) (string, error)
- func (w *Weixin) SendCustomMessage(token, openid, msg_type string, data utils.M) (string, error)
- func (w *Weixin) SendTemplateMessage(access_token string, data utils.M) error
- func (w *Weixin) SignJsTicket(data map[string]interface{}) string
- func (w *Weixin) WebAuth(redirect_uri string, mpid string, base bool) string
- type WxAccessToken
- type WxError
- type WxJsapiTicket
- type WxQrCode
- type WxUser
- type WxUserAccessToken
- type WxUserInfo
Constants ¶
View Source
const ( CACHE_FILE = 1 + iota CACHE_MEM )
View Source
const ( TCPStatusNone = iota TCPStatusConnected TCPStatusDisconnected )
TCP状态常量
View Source
const ( TCPEventConnected = iota TCPEventDisconnected TCPEventRecv TCPEventWritten )
TCP事件常量
Variables ¶
View Source
var CKRedisPool *redis.Pool
View Source
var ImageMime = map[string]string{
"image/jpeg": "jpg",
"image/jpg": "jpg",
"image/png": "png"}
Functions ¶
func GetActiveCount ¶ added in v1.0.6
func GetActiveCount() int
func GetIdleCount ¶ added in v1.0.6
func GetIdleCount() int
func InitRedisPool ¶
func InitRedisPool(cfg *RedisConfig)
Types ¶
type CKRedis ¶
type CKRedis struct {
// contains filtered or unexported fields
}
func (*CKRedis) SetMessageQueueName ¶
设置当前操作的消息队列名称
type ConnEvent ¶
type ConnEvent struct { EventType int Conn *Connection Data []byte }
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(c net.Conn, sendBufferSize int, eq IEventQueue) *Connection
func (*Connection) Close ¶
func (this *Connection) Close()
func (*Connection) GetConnId ¶
func (this *Connection) GetConnId() int
func (*Connection) GetReadTimeoutSec ¶
func (this *Connection) GetReadTimeoutSec() int
func (*Connection) GetStatus ¶
func (this *Connection) GetStatus() int
func (*Connection) GetUserdata ¶
func (this *Connection) GetUserdata() interface{}
func (*Connection) Send ¶
func (this *Connection) Send(msg []byte, cpy bool)
func (*Connection) SetConnId ¶
func (this *Connection) SetConnId(id int)
func (*Connection) SetReadTimeoutSec ¶
func (this *Connection) SetReadTimeoutSec(sec int)
func (*Connection) SetUserdata ¶
func (this *Connection) SetUserdata(ud interface{})
type FileCache ¶
type FileCache struct { CacheIn // contains filtered or unexported fields }
type GoroutinePool ¶
type GoroutinePool struct { Queue chan interface{} //队列池 Number int //并发协程数 Total int //处理数据量 Worker func(obj ...interface{}) bool // contains filtered or unexported fields }
协程池
func NewPoll ¶
func NewPoll(number int, worker func(obj ...interface{}) bool) *GoroutinePool
新建一个协程池
func (*GoroutinePool) AddTask ¶
func (this *GoroutinePool) AddTask(task interface{})
func (*GoroutinePool) AddTaskInterface ¶
func (this *GoroutinePool) AddTaskInterface(tasks []interface{})
func (*GoroutinePool) AddTaskStrings ¶
func (this *GoroutinePool) AddTaskStrings(tasks []string)
func (*GoroutinePool) SetFinishCallback ¶
func (this *GoroutinePool) SetFinishCallback(callback func())
func (*GoroutinePool) Start ¶
func (this *GoroutinePool) Start()
func (*GoroutinePool) Stop ¶
func (this *GoroutinePool) Stop()
type IEventHandler ¶
type IEventQueue ¶
type IEventTCP ¶
type IEventTCP interface { OnConnected(evt *TCPConnEvent) OnDisconnected(evt *TCPConnEvent) OnRecv(evt *TCPConnEvent) OnWritten(evt *TCPConnEvent) }
type IStreamProtocol ¶
type MemCache ¶
type MemCache struct { CacheIn // contains filtered or unexported fields }
GO本地内存数据缓存
type MemCacheData ¶
type MemCacheData struct {
// contains filtered or unexported fields
}
type RedisConfig ¶
type RedisConfig struct { RDServer string `json:"rd_server" yaml:"rd_server"` RDPort string `json:"rd_port" yaml:"rd_port"` RDDb int `json:"rd_db" yaml:"rd_db"` RDPassword string `json:"rd_password" yaml:"rd_password"` RDListName string `json:"rd_list_name" yaml:"rd_list_name"` RDPoolSize int `json:"rd_pool_size" yaml:"rd_pool_size"` RDIdleSize int `json:"rd_idle_size" yaml:"rd_idle_size"` }
redis 配置
type RedisGeo ¶
type RedisGeo struct { Member string `json:"member"` Lon float64 `json:"lon"` Lat float64 `json:"lat"` Dist float64 `json:"dist"` }
GEO地理位置
type TCPConnEvent ¶
type TCPConnEvent struct { EventType int Conn *TCPConnect Data interface{} }
事件类型结构数据
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
func NewTemplate ¶
type TemplateCon ¶
type Weixin ¶
type Weixin struct {
// contains filtered or unexported fields
}
func (*Weixin) CreateQrCode ¶
创建永久二维码
func (*Weixin) CreateTempQrCode ¶
创建临时二维码
func (*Weixin) CreateWxAppQrCode ¶
创建微信小程序二维码
func (*Weixin) GetAccessToken ¶
func (w *Weixin) GetAccessToken() (*WxAccessToken, error)
得到公众号全局 ACCESS_TOKEN
func (*Weixin) GetJsapiTicket ¶
func (w *Weixin) GetJsapiTicket(access_token string) (*WxJsapiTicket, error)
获取JsTicket
func (*Weixin) GetUserAccessToken ¶
func (w *Weixin) GetUserAccessToken(code string) (*WxUserAccessToken, error)
使用code获取用户access token
func (*Weixin) GetUserInfo ¶
func (w *Weixin) GetUserInfo(access_token string, openid string) (*WxUserInfo, error)
拉取用户信息
func (*Weixin) GetUserInfoAccessToken ¶
使用用户access token 获取用户信息
func (*Weixin) SendCustomMessage ¶
向用户发送客户消息
func (*Weixin) SendTemplateMessage ¶
发送模板消息
func (*Weixin) SignJsTicket ¶
进行JSTICKET签名
type WxAccessToken ¶
type WxJsapiTicket ¶
type WxQrCode ¶
type WxQrCode struct { Ticket string `json:"ticket"` ExpireSeconds int `json:"expire_seconds"` Url string `json:"url"` }
微信二维码结构
type WxUser ¶
type WxUser struct { NickName string `json:"nickname"` OpenId string `json:"openid"` Sex int `json:"sex"` Province string `json:"province"` City string `json:"city"` Country string `json:"country"` HeadImg string `json:"headimgurl"` UnionId string `json:"unionid"` }
网页受权接口获取用户数据
type WxUserAccessToken ¶
type WxUserInfo ¶
type WxUserInfo struct { Subscribe int `json:"subscribe"` Subscribe_time int `json:"subscribe_time"` Nickname string `json:"nickname"` OpenId string `json:"openid"` Sex int `json:"sex"` Province string `json:"province"` City string `json:"city"` Country string `json:"country"` HeadImg string `json:"headimgurl"` Language string `json:"language"` UnionId string `json:"unionid"` Remark string `json:"remark"` Groupid int `json:"groupid"` Tagid_list []int `json:"tagid_list"` }
用公众号接口获取的用户数据
Source Files
¶
Click to show internal directories.
Click to hide internal directories.