Documentation ¶
Index ¶
- Constants
- Variables
- func NewSeqno() string
- type Body
- type BytePool
- type Error
- type Group
- type Handler
- type Message
- type MessageBody
- type MessageContext
- func (c *MessageContext) Abort()
- func (c *MessageContext) AbortWithError(err error)
- func (c *MessageContext) Context() context.Context
- func (c *MessageContext) IsAborted() bool
- func (c *MessageContext) LogError(err error)
- func (c *MessageContext) Next()
- func (c *MessageContext) ShouldBindJson(v interface{}) error
- func (c *MessageContext) WithContext(ctx context.Context) *MessageContext
- type MessageContextPool
- type Server
Constants ¶
View Source
const ( OKCode = 0 OKMsg = "ok" )
Variables ¶
View Source
var ( ErrServerError = NewError(10000, "server error") ErrInvalidConnection = NewError(10001, "invalid connection") ErrHandleTimeout = NewError(10002, "handle timeout") ErrInvalidParams = NewError(10003, "invalid params") )
View Source
var (
ErrUnknownCmd = errors.New("unknown command")
)
Functions ¶
Types ¶
type BytePool ¶
type BytePool struct {
// contains filtered or unexported fields
}
func NewBytePool ¶
type Handler ¶
type Handler func(ctx *MessageContext)
type MessageBody ¶
type MessageBody struct { Cmd string `json:"cmd"` Seqno string `json:"seqno,omitempty"` Data json.RawMessage `json:"data,omitempty"` }
type MessageContext ¶
type MessageContext struct { Message *Message Body *MessageBody Server *Server Error error // contains filtered or unexported fields }
func (*MessageContext) Abort ¶
func (c *MessageContext) Abort()
func (*MessageContext) AbortWithError ¶
func (c *MessageContext) AbortWithError(err error)
func (*MessageContext) Context ¶
func (c *MessageContext) Context() context.Context
func (*MessageContext) IsAborted ¶
func (c *MessageContext) IsAborted() bool
func (*MessageContext) LogError ¶
func (c *MessageContext) LogError(err error)
func (*MessageContext) Next ¶
func (c *MessageContext) Next()
func (*MessageContext) ShouldBindJson ¶
func (c *MessageContext) ShouldBindJson(v interface{}) error
func (*MessageContext) WithContext ¶
func (c *MessageContext) WithContext(ctx context.Context) *MessageContext
type MessageContextPool ¶
type MessageContextPool struct {
// contains filtered or unexported fields
}
func NewMessageContextPool ¶
func NewMessageContextPool() *MessageContextPool
func (*MessageContextPool) Get ¶
func (p *MessageContextPool) Get() *MessageContext
func (*MessageContextPool) Put ¶
func (p *MessageContextPool) Put(c *MessageContext)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) SetLoopback ¶
Click to show internal directories.
Click to hide internal directories.