kernel

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultErrorHandler = func(err jsonrpc.Error) *rpcErrors.Error {
	if err != nil {
		return &rpcErrors.Error{
			Code:    rpcErrors.Code(err.GetCode()),
			Message: err.GetMessage(),
			Data:    err.GetData(),
		}
	}

	return nil
}

DefaultErrorHandler just proxy error interface into error struct.

Functions

This section is empty.

Types

type ErrorHandler

type ErrorHandler func(err jsonrpc.Error) *rpcErrors.Error

ErrorHandler allows to customize errors handling process.

type Kernel

type Kernel struct {
	InvokingErrorHandler ErrorHandler
	// contains filtered or unexported fields
}

Kernel is default kernel implementation.

func New

func New(router jsonrpc.Router) *Kernel

New creates new kernel for a working with PRC requests using Router.

func (*Kernel) HandleJSONRequest

func (kernel *Kernel) HandleJSONRequest(inJSON []byte) []byte

HandleJSONRequest accepts json request and returns processed json response.

func (*Kernel) ParseJSONToRequests

func (kernel *Kernel) ParseJSONToRequests(inJSON []byte) (requests *[]rpcRequest.Request, isBatch bool, err error)

ParseJSONToRequests accepts json string and convert it into requests slice.

Jump to

Keyboard shortcuts

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