Documentation ¶
Index ¶
- Variables
- func ParseCommands()
- type App
- func (a *App) APIRouter(router string, newGoRoutine bool, handlerFunc ...HandlerFunc)
- func (a *App) AddConfigFile(keyName, path, configType string) error
- func (a *App) AddExceptionHandler(handler gnError.ExceptionHandleFunc)
- func (a *App) BoadCastByGroupName(groupName string, data []byte)
- func (a *App) CMDHandler(cmd string, handler HandlerFunc)
- func (a *App) DelGroup(groupName string)
- func (a *App) DelObjectByTag(tag string)
- func (a *App) Done()
- func (a *App) ErrorToConnector(session *Session, code string, errorMsg string)
- func (a *App) GetConfigViper(keyName string) *viper.Viper
- func (a *App) GetGroup(groupName string) (*Group, bool)
- func (a *App) GetLinker() linker.ILinker
- func (a *App) GetObjectByTag(tag string) (interface{}, bool)
- func (a *App) GetRunRoutineNum() int
- func (a *App) GetServerConfig() *config.Config
- func (a *App) NewGroup(groupName string) *Group
- func (a *App) NotifyRPCJsonMsg(serverId string, handlerName string, obj interface{}) error
- func (a *App) NotifyRPCMsg(serverId string, handlerName string, data []byte) error
- func (a *App) NotifyRPCProtoBufMsg(serverId string, handlerName string, obj interface{}) error
- func (a *App) PushJsonMsg(session *Session, obj interface{})
- func (a *App) PushMsg(session *Session, data []byte)
- func (a *App) PushProtoBufMsg(session *Session, obj interface{})
- func (a *App) RPCRouter(router string, newGoRoutine bool, handlerFunc HandlerFunc)
- func (a *App) RequestRPCJsonMsg(serverId string, handlerName string, obj interface{}) (IPack, error)
- func (a *App) RequestRPCMsg(serverId string, handlerName string, data []byte) (IPack, error)
- func (a *App) RequestRPCProtoBufMsg(serverId string, handlerName string, obj interface{}) (IPack, error)
- func (a *App) Run() error
- func (a *App) SetObjectByTag(tag string, obj interface{})
- func (a *App) UseMiddleWare(middleWare ...GNMiddleWare)
- type AppCmd
- func (ap *AppCmd) AddCmdHandler(cmd string, handler HandlerFunc)
- func (ap *AppCmd) Done()
- func (ap *AppCmd) LoopCmdInChan(ctx context.Context)
- func (ap *AppCmd) MemHandler(pack IPack)
- func (ap *AppCmd) PingHandler(pack IPack)
- func (ap *AppCmd) ReceiveCmdPack(pack IPack)
- func (ap *AppCmd) Run() error
- type ChanMsgPacket
- type GNMiddleWare
- type Group
- type H
- type Handler
- type HandlerFunc
- type IApp
- type IAppCmd
- type IPack
- type Pack
- func (p *Pack) Abort()
- func (p *Pack) ExceptionAbortJson(code, msg string)
- func (p *Pack) GetAPP() IApp
- func (p *Pack) GetBindId() string
- func (p *Pack) GetContextValue(key string) interface{}
- func (p *Pack) GetData() []byte
- func (p *Pack) GetDstSubRouter() string
- func (p *Pack) GetHandlersTranferObj() interface{}
- func (p *Pack) GetRPCRespCode() int32
- func (p *Pack) GetReplyToken() string
- func (p *Pack) GetResults() []byte
- func (p *Pack) GetRouter() string
- func (p *Pack) GetSession() *Session
- func (p *Pack) GetSrcSubRouter() string
- func (p *Pack) IsAbort() bool
- func (p *Pack) ResultBytes(bytes []byte)
- func (p *Pack) ResultJson(obj interface{})
- func (p *Pack) ResultProtoBuf(obj interface{})
- func (p *Pack) SetContextValue(key string, value interface{})
- func (p *Pack) SetHandlersTranferObj(decodOjb interface{})
- func (p *Pack) SetRPCRespCode(code int)
- type Session
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ReTokenBase uint64 = 1
)
Functions ¶
func ParseCommands ¶
func ParseCommands()
Types ¶
type App ¶
type App struct { RRoutineCan context.CancelFunc WRoutineCan context.CancelFunc APIRoutineCan context.CancelFunc RPCRoutineCan context.CancelFunc // contains filtered or unexported fields }
func (*App) APIRouter ¶
func (a *App) APIRouter(router string, newGoRoutine bool, handlerFunc ...HandlerFunc)
func (*App) AddConfigFile ¶
func (*App) AddExceptionHandler ¶
func (a *App) AddExceptionHandler(handler gnError.ExceptionHandleFunc)
func (*App) BoadCastByGroupName ¶
func (*App) CMDHandler ¶
func (a *App) CMDHandler(cmd string, handler HandlerFunc)
func (*App) DelObjectByTag ¶
func (*App) ErrorToConnector ¶
func (*App) GetObjectByTag ¶
func (*App) GetRunRoutineNum ¶
func (*App) GetServerConfig ¶
func (*App) NotifyRPCJsonMsg ¶
func (*App) NotifyRPCMsg ¶
func (*App) NotifyRPCProtoBufMsg ¶
func (*App) PushJsonMsg ¶
func (*App) PushProtoBufMsg ¶
func (*App) RPCRouter ¶
func (a *App) RPCRouter(router string, newGoRoutine bool, handlerFunc HandlerFunc)
func (*App) RequestRPCJsonMsg ¶
func (*App) RequestRPCMsg ¶
func (*App) RequestRPCProtoBufMsg ¶
func (*App) SetObjectByTag ¶
func (*App) UseMiddleWare ¶
func (a *App) UseMiddleWare(middleWare ...GNMiddleWare)
type AppCmd ¶
type AppCmd struct {
// contains filtered or unexported fields
}
func (*AppCmd) AddCmdHandler ¶
func (ap *AppCmd) AddCmdHandler(cmd string, handler HandlerFunc)
func (*AppCmd) LoopCmdInChan ¶
func (*AppCmd) MemHandler ¶
func (*AppCmd) PingHandler ¶
func (*AppCmd) ReceiveCmdPack ¶
type ChanMsgPacket ¶
type ChanMsgPacket struct {
// contains filtered or unexported fields
}
多goroutine 通道同喜 封装 channel 传输用
type GNMiddleWare ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
group
func (*Group) AddSession ¶
func (*Group) BroadCastJson ¶
func (g *Group) BroadCastJson(obj interface{})
func (*Group) BroadCastProtoBuf ¶
func (g *Group) BroadCastProtoBuf(obj interface{})
func (*Group) DelSession ¶
type HandlerFunc ¶
type HandlerFunc func(IPack)
type IApp ¶
type IApp interface { PushMsg(session *Session, data []byte) PushJsonMsg(session *Session, obj interface{}) PushProtoBufMsg(session *Session, obj interface{}) NotifyRPCMsg(serverId string, handlerName string, data []byte) error NotifyRPCJsonMsg(serverId string, handlerName string, obj interface{}) error NotifyRPCProtoBufMsg(serverId string, handlerName string, obj interface{}) error RequestRPCMsg(serverId string, handlerName string, data []byte) (IPack, error) RequestRPCJsonMsg(serverId string, handlerName string, obj interface{}) (IPack, error) RequestRPCProtoBufMsg(serverId string, handlerName string, obj interface{}) (IPack, error) APIRouter(router string, newGoRoutine bool, handlerFunc ...HandlerFunc) RPCRouter(router string, newGoRoutine bool, handlerFunc HandlerFunc) CMDHandler(cmd string, handler HandlerFunc) NewGroup(groupName string) *Group GetGroup(groupName string) (*Group, bool) BoadCastByGroupName(groupName string, data []byte) DelGroup(groupName string) SetObjectByTag(tag string, obj interface{}) GetObjectByTag(tag string) (interface{}, bool) DelObjectByTag(tag string) Done() GetServerConfig() *config.Config Run() error AddExceptionHandler(handler gnError.ExceptionHandleFunc) GetLinker() linker.ILinker GetRunRoutineNum() int AddConfigFile(keyName, path, configType string) error GetConfigViper(keyName string) *viper.Viper UseMiddleWare(middleWare ...GNMiddleWare) // contains filtered or unexported methods }
IApp
type IAppCmd ¶
type IAppCmd interface { Run() error ReceiveCmdPack(pack IPack) AddCmdHandler(cmd string, handler HandlerFunc) Done() }
type IPack ¶
type IPack interface { Abort() IsAbort() bool GetAPP() IApp GetData() []byte SetHandlersTranferObj(decodOjb interface{}) GetHandlersTranferObj() interface{} GetSession() *Session GetRouter() string ResultJson(obj interface{}) ExceptionAbortJson(code, msg string) ResultProtoBuf(obj interface{}) ResultBytes(bytes []byte) GetResults() []byte GetReplyToken() string GetDstSubRouter() string GetSrcSubRouter() string GetBindId() string SetRPCRespCode(code int) GetRPCRespCode() int32 GetContextValue(key string) interface{} SetContextValue(key string, value interface{}) }
pack interface
type Pack ¶
type Pack struct {
// contains filtered or unexported fields
}
pack
func (*Pack) ExceptionAbortJson ¶
func (*Pack) GetContextValue ¶
func (*Pack) GetDstSubRouter ¶
func (*Pack) GetHandlersTranferObj ¶
func (p *Pack) GetHandlersTranferObj() interface{}
func (*Pack) GetRPCRespCode ¶
func (*Pack) GetReplyToken ¶
func (*Pack) GetResults ¶
func (*Pack) GetSession ¶
func (*Pack) GetSrcSubRouter ¶
func (*Pack) ResultBytes ¶
func (*Pack) ResultJson ¶
func (p *Pack) ResultJson(obj interface{})
func (*Pack) ResultProtoBuf ¶
func (p *Pack) ResultProtoBuf(obj interface{})
func (*Pack) SetContextValue ¶
func (*Pack) SetHandlersTranferObj ¶
func (p *Pack) SetHandlersTranferObj(decodOjb interface{})
func (*Pack) SetRPCRespCode ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func (*Session) GetSrcSubRouter ¶
Click to show internal directories.
Click to hide internal directories.