Documentation ¶
Index ¶
- Constants
- func ErrorHandler(re *Error, c echo.Context)
- func UnmarshalWithValidate(data []byte, v interface{}, vd echo.Validator) error
- type Address
- type Context
- type Error
- type ErrorCode
- type Handler
- type HexBytes
- type HexInt
- type IconOptions
- func (opts IconOptions) Del(key string)
- func (opts IconOptions) Get(key string) string
- func (opts IconOptions) GetBool(key string) (bool, error)
- func (opts IconOptions) GetInt(key string) (int64, error)
- func (opts IconOptions) Set(key, value string)
- func (opts IconOptions) SetBool(key string, value bool)
- func (opts IconOptions) SetInt(key string, v int64)
- func (opts IconOptions) ToHeaderValue() string
- type MethodRepository
- func (mr *MethodRepository) GetMethod(method string) Handler
- func (mr *MethodRepository) Handle(c echo.Context) error
- func (mr *MethodRepository) IsAllowedNotification(method string) bool
- func (mr *MethodRepository) RegisterMethod(method string, handler Handler)
- func (mr *MethodRepository) SetAllowedNotification(method string)
- func (mr *MethodRepository) Validator() *Validator
- type Params
- type Request
- type Response
- type Validator
Constants ¶
View Source
const ( Version = "2.0" DefaultBatchLimit = 10 )
View Source
const ( HeaderKeyIconOptions = "Icon-Options" IconOptionsDebug = "debug" IconOptionsTimeout = "timeout" )
View Source
const ( UnmarshalFailPrefix = "fail to unmarshal, " ValidateFailPrefix = "fail to validate, " JsonErrorPrefix = "json: " )
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
func ErrorHandler(re *Error, c echo.Context)
func UnmarshalWithValidate ¶ added in v0.9.10
Types ¶
type Context ¶
type Context struct { echo.Context // contains filtered or unexported fields }
func NewContext ¶
func NewContext(c echo.Context) *Context
func (*Context) BatchLimit ¶ added in v1.2.0
func (*Context) IncludeDebug ¶
func (*Context) MetricContext ¶ added in v1.2.0
type Error ¶
type Error struct { Code ErrorCode `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
func ErrInvalidParams ¶
func ErrInvalidParams(message ...interface{}) *Error
func ErrInvalidRequest ¶
func ErrInvalidRequest(message ...interface{}) *Error
func ErrMethodNotFound ¶
func ErrMethodNotFound(message ...interface{}) *Error
func ErrScoreWithStatus ¶
type ErrorCode ¶
type ErrorCode int
const ( ErrorCodeJsonParse ErrorCode = -32700 ErrorCodeInvalidRequest ErrorCode = -32600 ErrorCodeMethodNotFound ErrorCode = -32601 ErrorCodeInvalidParams ErrorCode = -32602 ErrorCodeInternal ErrorCode = -32603 ErrorCodeServer ErrorCode = -32000 ErrorCodeSystem ErrorCode = -31000 ErrorCodeScore ErrorCode = -30000 )
func (ErrorCode) NewWithData ¶
type IconOptions ¶
func NewIconOptionsByHeader ¶
func NewIconOptionsByHeader(h http.Header) IconOptions
func (IconOptions) Del ¶
func (opts IconOptions) Del(key string)
func (IconOptions) Get ¶
func (opts IconOptions) Get(key string) string
func (IconOptions) Set ¶
func (opts IconOptions) Set(key, value string)
func (IconOptions) SetBool ¶
func (opts IconOptions) SetBool(key string, value bool)
func (IconOptions) SetInt ¶
func (opts IconOptions) SetInt(key string, v int64)
func (IconOptions) ToHeaderValue ¶
func (opts IconOptions) ToHeaderValue() string
type MethodRepository ¶
type MethodRepository struct {
// contains filtered or unexported fields
}
func NewMethodRepository ¶
func NewMethodRepository(mtr *metric.JsonrpcMetric) *MethodRepository
func (*MethodRepository) GetMethod ¶ added in v0.9.10
func (mr *MethodRepository) GetMethod(method string) Handler
func (*MethodRepository) Handle ¶
func (mr *MethodRepository) Handle(c echo.Context) error
func (*MethodRepository) IsAllowedNotification ¶ added in v0.9.10
func (mr *MethodRepository) IsAllowedNotification(method string) bool
func (*MethodRepository) RegisterMethod ¶
func (mr *MethodRepository) RegisterMethod(method string, handler Handler)
func (*MethodRepository) SetAllowedNotification ¶ added in v0.9.10
func (mr *MethodRepository) SetAllowedNotification(method string)
func (*MethodRepository) Validator ¶ added in v1.3.0
func (mr *MethodRepository) Validator() *Validator
type Params ¶
type Params struct {
// contains filtered or unexported fields
}
func (*Params) RawMessage ¶
type Request ¶
type Request struct { Version string `json:"jsonrpc" validate:"required,version"` Method *string `json:"method"` Params json.RawMessage `json:"params,omitempty"` ID interface{} `json:"id" validate:"optional,id"` }
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) RegisterAlias ¶
func (*Validator) RegisterStructValidation ¶
func (v *Validator) RegisterStructValidation(fn validator.StructLevelFunc, types ...interface{})
func (*Validator) RegisterValidation ¶
Click to show internal directories.
Click to hide internal directories.