types

package
v0.0.0-...-63f831f Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHashOrNumber

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

func BlockHashOrNumberWithHash

func BlockHashOrNumberWithHash(hash common.Hash) BlockHashOrNumber

func BlockHashOrNumberWithHex

func BlockHashOrNumberWithHex(hex string) BlockHashOrNumber

func BlockHashOrNumberWithNumber

func BlockHashOrNumberWithNumber(blockNumber uint64) BlockHashOrNumber

func (BlockHashOrNumber) HashOrNumber

func (bhon BlockHashOrNumber) HashOrNumber() (common.Hash, bool, uint64)

func (BlockHashOrNumber) MarshalJSON

func (bhon BlockHashOrNumber) MarshalJSON() ([]byte, error)

func (*BlockHashOrNumber) UnmarshalJSON

func (bhon *BlockHashOrNumber) UnmarshalJSON(data []byte) error

type Lazy

type Lazy[T any] struct {
	// contains filtered or unexported fields
}

Lazy wraps encoded data and decode on demand for CPU saving.

func NewLazy

func NewLazy[T any](v T) (Lazy[T], error)

func NewLazyWithJson

func NewLazyWithJson[T any](jsonData []byte) Lazy[T]

func (*Lazy[T]) IsEmptyOrNull

func (lazy *Lazy[T]) IsEmptyOrNull() bool

IsEmptyOrNull indicates if the encoded data is empty or null value for pointer, map or slice type.

This is helpful to check if the wrapped object is nil without json unmarshal for CPU saving.

func (*Lazy[T]) Load

func (lazy *Lazy[T]) Load() (val T, err error)

Load returns the decoded data.

func (Lazy[T]) MarshalJSON

func (lazy Lazy[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Lazy[T]) MustLoad

func (lazy *Lazy[T]) MustLoad() T

MustLoad should always return the decoded data without any decode error.

func (*Lazy[T]) UnmarshalJSON

func (lazy *Lazy[T]) UnmarshalJSON(v []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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