Documentation ¶
Index ¶
Constants ¶
View Source
const Version string = "2.0"
Version is version of current JsonRPC <https://www.jsonrpc.org/specification>
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error interface { error // GetCode returns error code. GetCode() int // GetMessage returns error message. GetMessage() string // GetData returns error extra-data. GetData() interface{} }
Error is general RPC error.
type Method ¶
type Method interface { // GetName returns method name in string representation. GetName() string // GetParamsType says to Router a structure (or nil) which must be used for params parsing (fields, etc.). GetParamsType() interface{} // Handle will be called by Router when method with current name will be requested. Handle(params interface{}) (interface{}, Error) }
Method used as RPC method handler.
type Router ¶
type Router interface { // RegisterMethod make a method registration for later invoking. RegisterMethod(method Method) error // MethodIsRegistered returns `true` only if passed method is registered. MethodIsRegistered(methodName string) bool // Invoke accepts method name and invoke registered method with same name. Invoke(methodName string, params interface{}) (interface{}, Error) }
Router is used for methods registration and invoking.
Click to show internal directories.
Click to hide internal directories.