Versions in this module Expand all Collapse all v1 v1.0.10 Nov 30, 2020 v1.0.9 Nov 30, 2020 v1.0.8 Nov 30, 2020 v1.0.7 Nov 29, 2020 Changes in this version + func Base(r *http.Request) map[string]string v1.0.6 Nov 28, 2020 v1.0.5 Sep 5, 2020 v1.0.4 Sep 5, 2020 v1.0.3 Jun 26, 2020 Changes in this version type Ctx + Base func() map[string]string v1.0.2 Jun 24, 2020 Changes in this version type RPCError + func (e RPCError) SetData(data interface{}) RPCError v1.0.1 Jun 19, 2020 Changes in this version + const ParseError type Ctx + Bind func(interface{}) error + Header func(string) string + Logger func() Logger + type Logger interface + Debug func(msg string, fields ...interface{}) + Error func(msg string, fields ...interface{}) + Info func(msg string, fields ...interface{}) + SetBase func(base map[string]string) + Warn func(msg string, fields ...interface{}) type RPCError + func InternalError() RPCError + func InvalidParams() RPCError + func InvalidRequest() RPCError + func MethodNotFound() RPCError + func ServerError() RPCError type ServeMux + func (m *ServeMux) AddLogger(l Logger) *ServeMux v1.0.0 Mar 25, 2020 Changes in this version + func Params(params ...interface{}) interface + type Ctx interface + Error func(int, string, interface{}) error + Params func(interface{}) error + Req func() *http.Request + Success func(interface{}) error + type HTTPError struct + Code int + func (e *HTTPError) Error() string + type RPCClient interface + Call func(method string, params ...interface{}) (*RPCResponse, error) + CallBatch func(requests RPCRequests) (RPCResponses, error) + CallBatchRaw func(requests RPCRequests) (RPCResponses, error) + CallFor func(out interface{}, method string, params ...interface{}) error + CallRaw func(request *RPCRequest) (*RPCResponse, error) + func NewClient(endpoint string) RPCClient + func NewClientWithOpts(endpoint string, opts *RPCClientOpts) RPCClient + type RPCClientOpts struct + CustomHeaders map[string]string + HTTPClient *http.Client + type RPCError struct + Code int + Data interface{} + Message string + func SetError(code int, message string, data interface{}) RPCError + func (e RPCError) Error() string + type RPCRequest struct + ID int + JSONRPC string + Method string + Params interface{} + func NewRequest(method string, params ...interface{}) *RPCRequest + type RPCRequests []*RPCRequest + type RPCResponse struct + Error *RPCError + ID interface{} + JSONRPC string + Result interface{} + func (RPCResponse *RPCResponse) GetBool() (bool, error) + func (RPCResponse *RPCResponse) GetFloat() (float64, error) + func (RPCResponse *RPCResponse) GetInt() (int64, error) + func (RPCResponse *RPCResponse) GetObject(toType interface{}) error + func (RPCResponse *RPCResponse) GetString() (string, error) + type RPCResponses []*RPCResponse + func (res RPCResponses) AsMap() map[int]*RPCResponse + func (res RPCResponses) GetByID(id int) *RPCResponse + func (res RPCResponses) HasError() bool + type ServeMux struct + func NewServer(addr string) *ServeMux + func (m *ServeMux) Register(pattern string, handler func(Ctx) error) + func (m *ServeMux) Run() error + func (m *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (m *ServeMux) SetDefaultFunc(def func(http.ResponseWriter, *http.Request))