util

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPathAddress

func GetPathAddress(val interface{}, path string) (tezos.Address, bool)

func GetPathBig

func GetPathBig(val interface{}, path string) (*big.Int, bool)

func GetPathInt64

func GetPathInt64(val interface{}, path string) (int64, bool)

func GetPathString

func GetPathString(val interface{}, path string) (string, bool)

Access nested map or array contents

func GetPathTime

func GetPathTime(val interface{}, path string) (time.Time, bool)

func GetPathValue

func GetPathValue(val interface{}, path string) (interface{}, bool)

func GetPathZ

func GetPathZ(val interface{}, path string) (tezos.Z, bool)

func HasPath

func HasPath(val interface{}, path string) bool

func Min

func Min(x, y int) int

func NonNil

func NonNil(vals ...interface{}) interface{}

func ParseU64

func ParseU64(s string) (u uint64)

func ShortDurationString

func ShortDurationString(s string) string

func ToString

func ToString(t any) string

func WalkValueMap

func WalkValueMap(name string, val interface{}, fn ValueWalkerFunc) error

Types

type Bool

type Bool bool

func (Bool) Bool

func (b Bool) Bool() bool

func (Bool) False

func (b Bool) False() bool

func (Bool) True

func (b Bool) True() bool

func (*Bool) UnmarshalJSON

func (b *Bool) UnmarshalJSON(data []byte) error

func (*Bool) UnmarshalText

func (b *Bool) UnmarshalText(buf []byte) error

type HexBytes

type HexBytes []byte

HexBytes represents bytes as a JSON string of hexadecimal digits

func (HexBytes) Bytes

func (h HexBytes) Bytes() []byte

Bytes type-casts HexBytes back to a byte slice

func (HexBytes) MarshalText

func (h HexBytes) MarshalText() ([]byte, error)

MarshalText converts a byte slice to a hex encoded string. It implements the encoding.TextMarshaler interface, so that HexBytes can be used in Go structs in combination with the standard JSON library.

func (*HexBytes) ReadBytes

func (h *HexBytes) ReadBytes(r io.Reader, size int) error

ReadBytes copies size bytes from r into h. If h is nil or too short, a new byte slice is allocated. Fails with io.ErrShortBuffer when less than size bytes can be read from r.

func (HexBytes) String

func (h HexBytes) String() string

String converts a byte slice to a hex encoded string

func (HexBytes) U64

func (h HexBytes) U64() uint64

Return u64 value from decoded bytes

func (*HexBytes) UnmarshalText

func (h *HexBytes) UnmarshalText(data []byte) error

UnmarshalText umarshals a hex string to bytes. It implements the encoding.TextUnmarshaler interface, so that HexBytes can be used in Go structs in combination with the standard JSON library.

type StringList

type StringList []string

func (*StringList) UnmarshalJSON

func (l *StringList) UnmarshalJSON(data []byte) error

func (*StringList) UnmarshalText

func (l *StringList) UnmarshalText(data []byte) error

type Time

type Time time.Time

func (Time) Time

func (f Time) Time() time.Time

func (*Time) UnmarshalJSON

func (f *Time) UnmarshalJSON(data []byte) error

func (*Time) UnmarshalText

func (f *Time) UnmarshalText(buf []byte) error

type ValueWalkerFunc

type ValueWalkerFunc func(path string, value interface{}) error

Jump to

Keyboard shortcuts

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