README

jrpc

JSON-RPC v2.0 for https://echo.labstack.com/ framework

Expand ▾ Collapse ▴

Documentation

Overview

    Package jrpc implements JSON-RPC 2.0 for labstack echo server

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func NewError

    func NewError(code int, message string, data interface{}) error

      NewError creates instance of error

      func NewErrorInvalidParams

      func NewErrorInvalidParams(data interface{}) error

        NewErrorInvalidParams - helper func for create instance of Invalid params error

        Types

        type Context

        type Context interface {
        	Bind(interface{}) error
        	Result(interface{}) error
        }

          Context - json-rpc context

          type Error

          type Error interface {
          	Error() string
          }

            Error - json-rpc error interface

            func HandleMethod

            func HandleMethod(ec echo.Context, method HandlerFunc, params json.RawMessage) (json.RawMessage, Error)

              HandleMethod run jrpc handler

              type HandlerFunc

              type HandlerFunc func(c Context) error

                HandlerFunc - json-rpc handler

                type JRPC

                type JRPC interface {
                	Method(method string, handler HandlerFunc)
                }

                  JRPC interface

                  func Endpoint

                  func Endpoint(e *echo.Echo, path string, m ...echo.MiddlewareFunc) JRPC

                    Endpoint create instance of jrpc route