formatter

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatByteToRequest

func FormatByteToRequest(data []byte, v any) error

func FormatRequestToByte

func FormatRequestToByte(v any) ([]byte, error)

func GenerateId

func GenerateId() (string, error)

Types

type JsonRPCError

type JsonRPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type JsonRPCErrorResponse

type JsonRPCErrorResponse[T2 any] struct {
	Id      string        `json:"id"`
	Error   *JsonRPCError `json:"error"`
	Context T2            `json:"context"`
}

type JsonRPCRequest

type JsonRPCRequest[T any, T2 any] struct {
	Id      string `json:"id"`
	Path    string `json:"path"`
	Data    T      `json:"data"`
	Context T2     `json:"context"`
}

type JsonRPCResponse

type JsonRPCResponse[T any, T2 any] struct {
	Id      string `json:"id"`
	Result  T      `json:"result"`
	Context T2     `json:"context"`
}

type JsonRPCRoute

type JsonRPCRoute struct {
	Id   string `json:"id"`
	Path string `json:"path"`
}

Jump to

Keyboard shortcuts

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