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 CallFunc
- type FormatterFunc
- type Handler
- 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 ModuleInjecter
- type Route
- type Router
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPFormatter ¶
Types ¶
type FormatterFunc ¶ added in v1.8.0
type JsonRPCErrorBody ¶
func (JsonRPCErrorBody) MarshalEasyJSON ¶
func (v JsonRPCErrorBody) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (JsonRPCErrorBody) MarshalJSON ¶
func (v JsonRPCErrorBody) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*JsonRPCErrorBody) UnmarshalEasyJSON ¶
func (v *JsonRPCErrorBody) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*JsonRPCErrorBody) UnmarshalJSON ¶
func (v *JsonRPCErrorBody) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type JsonRPCRequest ¶
type JsonRPCRequest struct { ID string `json:"id"` Method string `json:"method"` Params json.RawMessage `json:"params,omitempty"` }
func (JsonRPCRequest) MarshalEasyJSON ¶
func (v JsonRPCRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (JsonRPCRequest) MarshalJSON ¶
func (v JsonRPCRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*JsonRPCRequest) UnmarshalEasyJSON ¶
func (v *JsonRPCRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*JsonRPCRequest) UnmarshalJSON ¶
func (v *JsonRPCRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type JsonRPCResponse ¶
type JsonRPCResponse struct { ID string `json:"id"` Result json.RawMessage `json:"result"` }
func (JsonRPCResponse) MarshalEasyJSON ¶
func (v JsonRPCResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (JsonRPCResponse) MarshalJSON ¶
func (v JsonRPCResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*JsonRPCResponse) UnmarshalEasyJSON ¶
func (v *JsonRPCResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*JsonRPCResponse) UnmarshalJSON ¶
func (v *JsonRPCResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type JsonRPCResponseError ¶
type JsonRPCResponseError struct { ID string `json:"id"` Error JsonRPCErrorBody `json:"error"` }
func (JsonRPCResponseError) MarshalEasyJSON ¶
func (v JsonRPCResponseError) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (JsonRPCResponseError) MarshalJSON ¶
func (v JsonRPCResponseError) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*JsonRPCResponseError) UnmarshalEasyJSON ¶
func (v *JsonRPCResponseError) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*JsonRPCResponseError) UnmarshalJSON ¶
func (v *JsonRPCResponseError) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Message ¶
type Message struct { Writer http.ResponseWriter Reader *http.Request Formatter FormatterFunc }
type ModuleInjecter ¶ added in v1.8.0
type ModuleInjecter interface { Handlers() []Handler Formatter() FormatterFunc Middleware() CallFunc }
type Route ¶ added in v1.8.0
type Route struct { Call CallFunc Middleware CallFunc Formatter FormatterFunc }
type Router ¶ added in v1.8.0
func (*Router) Add ¶ added in v1.8.0
func (h *Router) Add(hhi ModuleInjecter)