types

package
v2.5.5 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AppContextKey = constants.BINARY_NAME + "-app-context"

AppContextKey is the key in the context.Context which holds the application context.

Variables

View Source
var ErrUpstreamRpcReturnedError = errors.New("upstream RPC returned error")

ErrUpstreamRpcReturnedError is the error when the upstream RPC returned error

Functions

func DoEvmQuery added in v2.2.0

func DoEvmQuery(host string, qb JsonRpcQueryBuilder, optionalTimeout time.Duration) ([]byte, error)

func IsErrUpstreamRpcReturnedError

func IsErrUpstreamRpcReturnedError(err error) bool

IsErrUpstreamRpcReturnedError returns true if the error is built from upstream RPC response error, when error code is not zero.

func ParseJsonRpcResponse

func ParseJsonRpcResponse[T any](bz []byte) (any, error)

func WrapAppContext

func WrapAppContext(ctx Context) context.Context

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext() Context

func UnwrapAppContext

func UnwrapAppContext(ctx context.Context) Context

func (Context) Deadline

func (c Context) Deadline() (deadline time.Time, ok bool)

func (Context) Done

func (c Context) Done() <-chan struct{}

func (Context) Err

func (c Context) Err() error

func (Context) Value

func (c Context) Value(key any) any

func (Context) WithContext

func (c Context) WithContext(ctx context.Context) Context

type ContextKey

type ContextKey string

ContextKey defines a type alias for a stdlib Context key.

type JsonRpcQueryBuilder

type JsonRpcQueryBuilder interface {
	String() string
}

func NewJsonRpcQueryBuilder

func NewJsonRpcQueryBuilder(
	method string,
	params ...JsonRpcQueryParam,
) JsonRpcQueryBuilder

type JsonRpcQueryParam

type JsonRpcQueryParam interface {
	// IsArray returns true if the param is array formed
	IsArray() bool

	// String returns string of the param
	String() string
}

func NewJsonRpcBoolQueryParam

func NewJsonRpcBoolQueryParam(value bool) JsonRpcQueryParam

func NewJsonRpcInt64QueryParam

func NewJsonRpcInt64QueryParam(num int64) JsonRpcQueryParam

func NewJsonRpcIntQueryParam

func NewJsonRpcIntQueryParam(num int) JsonRpcQueryParam

func NewJsonRpcRawQueryParam

func NewJsonRpcRawQueryParam(rawStr string) JsonRpcQueryParam

func NewJsonRpcStringArrayQueryParam

func NewJsonRpcStringArrayQueryParam(strArr ...string) (JsonRpcQueryParam, error)

func NewJsonRpcStringQueryParam

func NewJsonRpcStringQueryParam(str string) (JsonRpcQueryParam, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳