Documentation ¶
Index ¶
- func HTTPFormatter(m *Message, code int, headers map[string]string, body interface{})
- func JsonRPCFormatter(m *Message, code int, headers map[string]string, body interface{})
- type CallHandler
- type FMT
- type FN
- type HttpHandler
- type HttpHandlerInterface
- type HttpHandlerItem
- type JsonRPCErrorBody
- type JsonRPCRequest
- type JsonRPCResponse
- type JsonRPCResponseError
- type Message
- func (m *Message) Decode(call func([]byte) error) error
- func (m *Message) Empty(code int)
- func (m *Message) Encode(call func() (int, map[string]string, interface{}))
- func (m *Message) Error(code int, err error)
- func (m *Message) GetCookies() map[string]*http.Cookie
- func (m *Message) Redirect(url string)
- func (m *Message) SetCookie(key, value string, ttl time.Duration)
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPFormatter ¶ added in v1.6.0
Types ¶
type CallHandler ¶ added in v1.6.0
type HttpHandler ¶
func NewHttpHandler ¶
func NewHttpHandler() *HttpHandler
func (*HttpHandler) Route ¶
func (h *HttpHandler) Route(hhi HttpHandlerInterface)
func (*HttpHandler) ServeHTTP ¶
func (h *HttpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HttpHandlerInterface ¶ added in v1.6.0
type HttpHandlerInterface interface { Handlers() []CallHandler Formatter() FMT Middelware() FN }
type HttpHandlerItem ¶ added in v1.6.0
type JsonRPCErrorBody ¶ added in v1.6.0
func (JsonRPCErrorBody) MarshalEasyJSON ¶ added in v1.6.0
func (v JsonRPCErrorBody) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (JsonRPCErrorBody) MarshalJSON ¶ added in v1.6.0
func (v JsonRPCErrorBody) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*JsonRPCErrorBody) UnmarshalEasyJSON ¶ added in v1.6.0
func (v *JsonRPCErrorBody) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*JsonRPCErrorBody) UnmarshalJSON ¶ added in v1.6.0
func (v *JsonRPCErrorBody) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type JsonRPCRequest ¶ added in v1.6.0
type JsonRPCRequest struct { ID string `json:"id"` Method string `json:"method"` Params json.RawMessage `json:"params,omitempty"` }
func (JsonRPCRequest) MarshalEasyJSON ¶ added in v1.6.0
func (v JsonRPCRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (JsonRPCRequest) MarshalJSON ¶ added in v1.6.0
func (v JsonRPCRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*JsonRPCRequest) UnmarshalEasyJSON ¶ added in v1.6.0
func (v *JsonRPCRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*JsonRPCRequest) UnmarshalJSON ¶ added in v1.6.0
func (v *JsonRPCRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type JsonRPCResponse ¶ added in v1.6.0
type JsonRPCResponse struct { ID string `json:"id"` Result json.RawMessage `json:"result"` }
func (JsonRPCResponse) MarshalEasyJSON ¶ added in v1.6.0
func (v JsonRPCResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (JsonRPCResponse) MarshalJSON ¶ added in v1.6.0
func (v JsonRPCResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*JsonRPCResponse) UnmarshalEasyJSON ¶ added in v1.6.0
func (v *JsonRPCResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*JsonRPCResponse) UnmarshalJSON ¶ added in v1.6.0
func (v *JsonRPCResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type JsonRPCResponseError ¶ added in v1.6.0
type JsonRPCResponseError struct { ID string `json:"id"` Error JsonRPCErrorBody `json:"error"` }
func (JsonRPCResponseError) MarshalEasyJSON ¶ added in v1.6.0
func (v JsonRPCResponseError) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (JsonRPCResponseError) MarshalJSON ¶ added in v1.6.0
func (v JsonRPCResponseError) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*JsonRPCResponseError) UnmarshalEasyJSON ¶ added in v1.6.0
func (v *JsonRPCResponseError) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*JsonRPCResponseError) UnmarshalJSON ¶ added in v1.6.0
func (v *JsonRPCResponseError) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Message ¶
type Message struct { Writer http.ResponseWriter Reader *http.Request Formatter FMT }