jsonrpc

package
v0.0.0-...-8dc8ab2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}
type Header struct {
	Id      json.Number `json:"id"`
	JsonRpc string      `json:"jsonrpc"`
	Method  string      `json:"method,omitempty"`
}

func ReadHeader

func ReadHeader(bs []byte) (*Header, []byte, error)

type Request

type Request struct {
	Header
	Params interface{} `json:"params"`
}

func NewRequest

func NewRequest(id json.Number, method string, params interface{}) (*Request, error)

type Response

type Response[T any] struct {
	Id      interface{} `json:"id"`
	JsonRpc string      `json:"jsonrpc"`
	Result  T           `json:"result"`
	Error   *Error      `json:"error,omitempty"`
}

func NewResponse

func NewResponse[T any](id json.Number, result T) *Response[T]

Jump to

Keyboard shortcuts

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