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)
- func ReplaceInterface[T any](anyList []T) []interface{}
- 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) Key(key string) string
- 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) SAdd(key string, member ...interface{}) (int, error)
- func (m *CKRedis) SCard(key string) (int, error)
- func (m *CKRedis) SIsMember(key string, member string) (bool, error)
- func (m *CKRedis) SMembers(key string) ([]interface{}, error)
- func (m *CKRedis) SPop(key string) ([]byte, error)
- func (m *CKRedis) SRem(key string, member ...interface{}) (bool, error)
- func (m *CKRedis) SScan(key string, cursor int, match string, count int) (*ScanList, error)
- func (m *CKRedis) SUnionStore(keys ...interface{}) (int, 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) SetPrefix(prefix 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
- type IEventHandler
- type IEventQueue
- type IEventTCP
- type IStreamProtocol
- type MediaData
- type MemCache
- type MemCacheData
- type RedisConfig
- type RedisGeo
- type ScanList
- type SysLog
- type TCPConnEvent
- type TCPConnect
- func (tp *TCPConnect) Close()
- func (tp *TCPConnect) RemoteAddr() string
- func (tp *TCPConnect) Run()
- func (tp *TCPConnect) SetDebug(yes bool)
- func (tp *TCPConnect) SetReadTimeout(step time.Duration)
- func (tp *TCPConnect) SetWriteTimeout(step time.Duration)
- func (tp *TCPConnect) Status() int
- func (tp *TCPConnect) WriteData(data []byte)
- type TagList
- type Template
- type TemplateCon
- type Upload
- type UserTag
- type Weixin
- func (w *Weixin) CancelUserTag(token string, tagId int, openIdList []string) (string, error)
- func (w *Weixin) CreateQrCode(token, content string) (*WxQrCode, error)
- func (w *Weixin) CreateTag(token, name string) (string, 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) DeleteTag(token string, id 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) GetTagUsers(token string, tagId int, nextOpenid string) (string, error)
- func (w *Weixin) GetTags(token string) (*TagList, 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) GetUserTags(token, openId string) (string, 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) SetUserTag(token string, tagId int, openIdList []string) (string, error)
- func (w *Weixin) SignJsTicket(data map[string]interface{}) string
- func (w *Weixin) UpdateTag(token string, id int, name string) (string, error)
- 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 TCPEventError )
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)
func ReplaceInterface ¶ added in v1.5.1
func ReplaceInterface[T any](anyList []T) []interface{}
Types ¶
type CKRedis ¶
type CKRedis struct {
// contains filtered or unexported fields
}
func (*CKRedis) SUnionStore ¶ added in v1.3.4
复制并集
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 NewPool ¶ added in v1.5.1
func NewPool(number int, worker func(obj ...interface{}) bool) *GoroutinePool
NewPool 新建一个协程池
func (*GoroutinePool) AddTask ¶
func (g *GoroutinePool) AddTask(task interface{})
func (*GoroutinePool) AddTaskInterface ¶
func (g *GoroutinePool) AddTaskInterface(tasks []interface{})
func (*GoroutinePool) AddTaskStrings ¶
func (g *GoroutinePool) AddTaskStrings(tasks []string)
func (*GoroutinePool) SetFinishCallback ¶
func (g *GoroutinePool) SetFinishCallback(callback func())
func (*GoroutinePool) Start ¶
func (g *GoroutinePool) Start()
func (*GoroutinePool) Stop ¶
func (g *GoroutinePool) Stop()
type IEventHandler ¶
type IEventQueue ¶
type IEventTCP ¶
type IEventTCP interface { OnConnected(evt *TCPConnEvent) OnDisconnected(evt *TCPConnEvent) OnRecv(evt *TCPConnEvent) OnWritten(evt *TCPConnEvent) OnError(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 SysLog ¶
type SysLog struct {
Prefix string
}
func (*SysLog) PrintError ¶ added in v1.1.7
func (l *SysLog) PrintError(err interface{})
type TCPConnEvent ¶
type TCPConnEvent struct { EventType int Conn *TCPConnect Data interface{} }
事件类型结构数据
type TCPConnect ¶
type TCPConnect struct {
// contains filtered or unexported fields
}
TCP连接
func (*TCPConnect) RemoteAddr ¶ added in v1.4.2
func (tp *TCPConnect) RemoteAddr() string
func (*TCPConnect) SetWriteTimeout ¶ added in v1.4.2
func (tp *TCPConnect) SetWriteTimeout(step time.Duration)
设置写入超时时间
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) CancelUserTag ¶ added in v1.2.4
批量为用户取消标签
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) GetTagUsers ¶ added in v1.2.4
获取标签下粉丝列表
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) GetUserTags ¶ added in v1.2.4
获取用户身上的标签列表
func (*Weixin) SendCustomMessage ¶
向用户发送客户消息
func (*Weixin) SendTemplateMessage ¶
发送模板消息
func (*Weixin) SetUserTag ¶ added in v1.2.4
批量为用户打标签
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 WxUserAccessToken struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` OpenId string `json:"openid"` Scope string `json:"scope"` UnionId string `json:"unionid"` }
用户ACCESS
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.