Documentation
¶
Index ¶
- Constants
- func BytesToInt32(data []byte, bigEndian bool) int32
- func Daemon(skip ...string)
- func DebugLog(v ...interface{})
- func ErrorLog(v ...interface{})
- func FatalLog(v ...interface{})
- func GetNewLineString() string
- func GetNewUUID() string
- func GetRandomString(l int) string
- func Go(f func(Stop chan struct{}))
- func Go2(f func())
- func InfoLog(v ...interface{})
- func Int32ToBytes(n int32, bigEndian bool) []byte
- func IsDirExists(path string) bool
- func IsEmpty(content string) bool
- func IsFileExists(path string) (bool, error)
- func IsUUIDEmpty(uuid string) bool
- func IsUUIDEqual(uuid1, uuid2 string) bool
- func Md5Bytes(b []byte, ifUpper bool) string
- func Md5String(s string, ifUpper bool) string
- func Publish(channel string, data []byte)
- func RandInt() int
- func RandInt32() int32
- func RandInt32n(n int32) int32
- func RandInt64() int64
- func RandInt64n(n int64) int64
- func RandIntN(n int) int
- func RandUint32() uint32
- func RandUint64() uint64
- func ReadJsonFile(path string, v interface{}) error
- func RegisterFiveMinuteFunc(funcName string, f timerFunc)
- func RegisterOneMinuteFunc(funcName string, f timerFunc)
- func RegisterSystemExitFunc(f func())
- func RegisterSystemReloadFunc(f func())
- func RegisterThirtyMinuteFunc(funcName string, f timerFunc)
- func RpcCall(channel string, data []byte, timeout int32) ([]byte, error)
- func Shuffle(n int, swap func(i, j int))
- func SimpleTack() string
- func Stack()
- func StartLog(dirPatch string, lv logLv)
- func StartNatConn(addr, natName string)
- func StartTcpServer(addr string, handler ClientCallBack, clientExpireHandler ClientExpireCallBack, ...) error
- func StartUdpServer(addr string, handler ClientCallBack, headerLen int32) error
- func StartWebSocketServer(addr string, url string, handler ClientCallBack, ...) error
- func SubscribeAsync(channel string, cb NatCallBack)
- func SubscribeChannel(channel string, channelCount int32, cb NatCallBack)
- func SubscribeQueue(channel, queue string, cb NatCallBack)
- func ToDate(timeVal string) (time.Time, error)
- func ToDateString(timeVal time.Time) string
- func ToDateTime(timeVal string) (time.Time, error)
- func ToDateTimeString(timeVal time.Time) string
- func Try(f func(), handler func(interface{}))
- func WaitForSystemExit()
- func WarnLog(v ...interface{})
- type Client
- func (c *Client) AppendReceiveQueue(message []byte)
- func (c *Client) AppendSendQueue(message []byte)
- func (c *Client) GetActiveTime() int64
- func (c *Client) GetConn() net.Conn
- func (c *Client) GetReceiveData(headerLen int32) (message []byte, exists bool)
- func (c *Client) GetStop() bool
- func (c *Client) SetActiveTime()
- func (c *Client) SetStop()
- type ClientCallBack
- type ClientExpireCallBack
- type Csv
- type Mysql
- type NatCallBack
- type NatResult
- type Redis
- func (r *Redis) GetConnection() *redis.Client
- func (r *Redis) HDel(key string, field ...string) int64
- func (r *Redis) HExists(key, field string) bool
- func (r *Redis) HGet(key, field string) string
- func (r *Redis) HGetAll(key string) map[string]string
- func (r *Redis) HIncrBy(key, field string, incr int64) int64
- func (r *Redis) HIncrByFloat(key, field string, incr float64) float64
- func (r *Redis) HKeys(key string) []string
- func (r *Redis) HLen(key string) int64
- func (r *Redis) HMGet(key string, field ...string) []interface{}
- func (r *Redis) HMSet(key string, field map[string]interface{}) string
- func (r *Redis) HSet(key, field string, value interface{}) bool
- func (r *Redis) HSetNX(key string, field string, value interface{}) bool
- func (r *Redis) HVals(key string) []string
- type UdpClient
- type WebServer
- type WebSocketClient
- func (c *WebSocketClient) AppendSendQueue(message []byte)
- func (c *WebSocketClient) GetActiveTime() int64
- func (c *WebSocketClient) GetConn() *websocket.Conn
- func (c *WebSocketClient) GetReceiveData(headerLen int32, data []byte) (message []byte, exists bool)
- func (c *WebSocketClient) GetStop() bool
- func (c *WebSocketClient) SetActiveTime()
- func (c *WebSocketClient) SetStop()
Constants ¶
View Source
const ( GET webRequestType = "GET" POST webRequestType = "POST" DELETE webRequestType = "DELETE" PATCH webRequestType = "PATCH" PUT webRequestType = "PUT" OPTIONS webRequestType = "OPTIONS" HEAD webRequestType = "HEAD" )
View Source
const ( Debug logLv = iota //调试信息 Info //资讯讯息 Warn //警告状况发生 Error //一般错误,可能导致功能不正常 Fatal //严重错误,会导致进程退出 )
Variables ¶
This section is empty.
Functions ¶
func BytesToInt32 ¶
func Int32ToBytes ¶
func RandInt32n ¶ added in v0.0.2
func RandInt64n ¶ added in v0.0.2
func RandUint32 ¶ added in v0.0.2
func RandUint32() uint32
func RandUint64 ¶ added in v0.0.2
func RandUint64() uint64
func RegisterFiveMinuteFunc ¶
func RegisterFiveMinuteFunc(funcName string, f timerFunc)
func RegisterOneMinuteFunc ¶
func RegisterOneMinuteFunc(funcName string, f timerFunc)
func RegisterSystemExitFunc ¶
func RegisterSystemExitFunc(f func())
func RegisterSystemReloadFunc ¶
func RegisterSystemReloadFunc(f func())
func RegisterThirtyMinuteFunc ¶
func RegisterThirtyMinuteFunc(funcName string, f timerFunc)
func SimpleTack ¶
func SimpleTack() string
func StartNatConn ¶
func StartNatConn(addr, natName string)
func StartTcpServer ¶
func StartTcpServer(addr string, handler ClientCallBack, clientExpireHandler ClientExpireCallBack, headerLen int32) error
func StartUdpServer ¶
func StartUdpServer(addr string, handler ClientCallBack, headerLen int32) error
func StartWebSocketServer ¶
func StartWebSocketServer(addr string, url string, handler ClientCallBack, clientExpireHandler ClientExpireCallBack, headerLen int32) error
启动服务器
func SubscribeChannel ¶
func SubscribeChannel(channel string, channelCount int32, cb NatCallBack)
管道模式订阅
func WaitForSystemExit ¶
func WaitForSystemExit()
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func GetTcpClient ¶
func (*Client) AppendReceiveQueue ¶
func (*Client) AppendSendQueue ¶
func (*Client) GetActiveTime ¶
func (*Client) GetReceiveData ¶
func (*Client) SetActiveTime ¶
func (c *Client) SetActiveTime()
type ClientCallBack ¶
type ClientExpireCallBack ¶
type ClientExpireCallBack func(addr []string)
type Csv ¶
type Csv struct {
// contains filtered or unexported fields
}
func NewCsvReader ¶
func NewCsvReader() *Csv
func (*Csv) UnMarshalFile ¶
func (*Csv) UnMarshalFileWithHeader ¶
type Mysql ¶
type Mysql struct {
// contains filtered or unexported fields
}
func (*Mysql) GetConnectionStr ¶
func (*Mysql) RegisterTableModel ¶
func (*Mysql) RegisterTableModelForTableName ¶
type NatCallBack ¶
type NatCallBack func(result *NatResult)
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
func (*Redis) GetConnection ¶
type UdpClient ¶
type UdpClient struct {
// contains filtered or unexported fields
}
func GetUdpClient ¶
func (*UdpClient) GetReceiveData ¶
func (*UdpClient) SetSendQueue ¶
type WebServer ¶
type WebServer struct {
// contains filtered or unexported fields
}
func NewWebServer ¶
func (*WebServer) RegisterRequestHandleFunc ¶
func (w *WebServer) RegisterRequestHandleFunc(requestType webRequestType, url string, handleFunc gin.HandlerFunc)
func (*WebServer) StartWebServer ¶
func (w *WebServer) StartWebServer()
type WebSocketClient ¶
type WebSocketClient struct {
// contains filtered or unexported fields
}
func (*WebSocketClient) AppendSendQueue ¶
func (c *WebSocketClient) AppendSendQueue(message []byte)
func (*WebSocketClient) GetActiveTime ¶
func (c *WebSocketClient) GetActiveTime() int64
func (*WebSocketClient) GetConn ¶
func (c *WebSocketClient) GetConn() *websocket.Conn
func (*WebSocketClient) GetReceiveData ¶
func (c *WebSocketClient) GetReceiveData(headerLen int32, data []byte) (message []byte, exists bool)
func (*WebSocketClient) GetStop ¶
func (c *WebSocketClient) GetStop() bool
func (*WebSocketClient) SetActiveTime ¶
func (c *WebSocketClient) SetActiveTime()
func (*WebSocketClient) SetStop ¶
func (c *WebSocketClient) SetStop()
Source Files
¶
- func_csv.go
- func_go.go
- func_init.go
- func_log.go
- func_mysql.go
- func_nats.go
- func_redis.go
- func_system.go
- func_tcp.go
- func_tcp_client.go
- func_timer.go
- func_udp.go
- func_udp_client.go
- func_web_server.go
- func_ws.go
- func_ws_client.go
- global_const.go
- global_enum.go
- global_variable.go
- util_buff.go
- util_file.go
- util_rand.go
- util_string.go
- util_time.go
Click to show internal directories.
Click to hide internal directories.