Versions in this module Expand all Collapse all v2 v2.2.7 Mar 31, 2022 v2.2.6 Mar 31, 2022 Changes in this version + const IDKey + const InternalError + const InvalidParams + const InvalidRequest + const MethodNotFound + const ParseError + const ServerError + const Version + func ConvertToObject(keys []string, params json.RawMessage) (json.RawMessage, error) + func ErrorMsg(code int) string + func IDFromContext(ctx context.Context) *json.RawMessage + func IsArray(message json.RawMessage) bool + func NamespaceFromContext(ctx context.Context) string + func RequestFromContext(ctx context.Context) (*http.Request, bool) + func SMDBoxHandler(w http.ResponseWriter, r *http.Request) + type Error struct + Code int + Data interface{} + Err error + Message string + func NewError(code int, err error) *Error + func NewStringError(code int, message string) *Error + func (e Error) Error() string + func (e Error) Unwrap() error + type InvokeFunc func(context.Context, string, json.RawMessage) Response + type Invoker interface + Invoke func(ctx context.Context, method string, params json.RawMessage) Response + SMD func() smd.ServiceInfo + type MiddlewareFunc func(InvokeFunc) InvokeFunc + func Logger(l *log.Logger) MiddlewareFunc + func Metrics(appName string) MiddlewareFunc + type Options struct + AllowCORS bool + BatchMaxLen int + DisableTransportChecks bool + ExposeSMD bool + HideErrorDataField bool + TargetURL string + Upgrader *websocket.Upgrader + type Printer interface + Printf func(string, ...interface{}) + type Request struct + ID *json.RawMessage + Method string + Namespace string + Params json.RawMessage + Version string + type Response struct + Error *Error + Extensions map[string]interface{} + ID *json.RawMessage + Result *json.RawMessage + Version string + func NewResponseError(id *json.RawMessage, code int, message string, data interface{}) Response + func (r *Response) Set(v interface{}, er ...error) + func (r Response) JSON() []byte + type Server struct + func NewServer(opts Options) Server + func (s *Server) Register(namespace string, service Invoker) + func (s *Server) RegisterAll(services map[string]Invoker) + func (s *Server) SetLogger(printer Printer) + func (s *Server) Use(m ...MiddlewareFunc) + func (s Server) Do(ctx context.Context, req []byte) ([]byte, error) + func (s Server) SMD() smd.Schema + func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s Server) ServeWS(w http.ResponseWriter, r *http.Request) + type Service struct Other modules containing this package github.com/dizzyfool/zenrpc