jrpc

package module
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 6 Imported by: 0

README

jrpc

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

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 {
	EchoContext() echo.Context
	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, middleware ...MiddlewareFunc)
}

JRPC interface

func Endpoint

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

Endpoint create instance of jrpc route

type MiddlewareFunc added in v0.9.2

type MiddlewareFunc func(HandlerFunc) HandlerFunc

MiddlewareFunc defines a function to process json-rpc middleware.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL