utils

package
v0.0.0-...-50f0b53 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntStr    = "int"
	Int8Str   = "int8"
	Int16Str  = "int16"
	Int32Str  = "int32"
	Int64Str  = "int64"
	UintStr   = "uint"
	Uint8Str  = "uint8"
	Uint16Str = "uint16"
	Uint32Str = "uint32"
	Uint64Str = "uint64"

	BoolStr    = "bool"
	BytesStr   = "bytes"
	StringStr  = "string"
	AddressStr = "address"
)

Variables

View Source
var (
	LBracketToken = "["
	RBracketToken = "]"
	BracketToken  = "[]"
	CommaToken    = ","
	RowSplit      = ":"
	// ColSplit      = ";"
	ColSplit = CommaToken
)
View Source
var (
	IntTyp     = reflect.TypeOf(int(0))
	Int8Typ    = reflect.TypeOf(int8(0))
	Int16Typ   = reflect.TypeOf(int16(0))
	Int32Typ   = reflect.TypeOf(int32(0))
	Int64Typ   = reflect.TypeOf(int64(0))
	UintTyp    = reflect.TypeOf(uint(0))
	Uint8Typ   = reflect.TypeOf(uint8(0))
	Uint16Typ  = reflect.TypeOf(uint16(0))
	Uint32Typ  = reflect.TypeOf(uint32(0))
	Uint64Typ  = reflect.TypeOf(uint64(0))
	BigintTyp  = reflect.TypeOf((*big.Int)(nil))
	StrTyp     = reflect.TypeOf(string(""))
	AddressTyp = reflect.TypeOf(common.Address{})
	BoolTyp    = reflect.TypeOf(bool(true))
	BytesTyp   = reflect.TypeOf([]byte(""))
	ByteTyp    = reflect.TypeOf((*byte)(nil)).Elem()
)

Functions

func GetBytesType

func GetBytesType(arrTyp string) (reflect.Type, error)

func GetIntegerType

func GetIntegerType(argType string) (reflect.Type, error)

func ToETHAddress

func ToETHAddress(addrStr string) (common.Address, error)

Types

type AddrParser

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

func NewAddrParser

func NewAddrParser(d string) *AddrParser

func (*AddrParser) List

func (p *AddrParser) List() ([]any, error)

func (*AddrParser) Lists

func (p *AddrParser) Lists() ([][]any, error)

func (*AddrParser) One

func (p *AddrParser) One() (any, error)

type ArrayTyp

type ArrayTyp int
const (
	// single type: uint64 or bool
	Single ArrayTyp = iota
	// []
	Slice
	// [][]
	DoubleSlice
	// [2]
	FixedArray
	// [2][2]
	DoubleFixedArray
	// [2][]
	LFixedArray
	// [][2]
	RFixedArray
)

type BoolParser

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

func NewBoolParser

func NewBoolParser(d string) *BoolParser

func (*BoolParser) List

func (p *BoolParser) List() ([]any, error)

func (*BoolParser) Lists

func (p *BoolParser) Lists() ([][]any, error)

func (*BoolParser) One

func (p *BoolParser) One() (any, error)

type BytesParser

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

func NewBytesParser

func NewBytesParser(d string, typ reflect.Type) *BytesParser

func (*BytesParser) List

func (p *BytesParser) List() ([]any, error)

func (*BytesParser) Lists

func (p *BytesParser) Lists() ([][]any, error)

func (*BytesParser) One

func (p *BytesParser) One() (any, error)

type IntegerParser

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

func NewIntegerParser

func NewIntegerParser(d string, typ reflect.Type) *IntegerParser

func (*IntegerParser) List

func (p *IntegerParser) List() ([]any, error)

func (*IntegerParser) Lists

func (p *IntegerParser) Lists() ([][]any, error)

func (*IntegerParser) One

func (p *IntegerParser) One() (any, error)

type Parser

type Parser interface {
	One() (any, error)
	List() ([]any, error)
	Lists() ([][]any, error)
}

type StrParser

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

func NewStrParser

func NewStrParser(d string) *StrParser

func (*StrParser) List

func (p *StrParser) List() ([]any, error)

func (*StrParser) Lists

func (p *StrParser) Lists() ([][]any, error)

func (*StrParser) One

func (p *StrParser) One() (any, error)

type TypeInfo

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

func NewTypeInfo

func NewTypeInfo(at ArrayTyp, et reflect.Type, p Parser, left, right int) *TypeInfo

func (*TypeInfo) Parse

func (ti *TypeInfo) Parse() (any, error)

Jump to

Keyboard shortcuts

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