conversions

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const SolidityIntSize uint = 256

SolidityIntSize is the size of a Solidity int in bits.

Variables

This section is empty.

Functions

func BytesToInt64 added in v1.3.0

func BytesToInt64(bytes []byte) int64

func FloatToNumeric

func FloatToNumeric(f *big.Float) (pgtype.Numeric, error)

func Int64ToBytes added in v1.3.0

func Int64ToBytes(i int64) []byte

func IntToNumeric

func IntToNumeric(i *big.Int) (pgtype.Numeric, error)

func MapValsToArr

func MapValsToArr[T comparable, U any](m map[T]U) []U

func MustFloatToNumeric

func MustFloatToNumeric(f *big.Float) pgtype.Numeric

func MustIntToNumeric

func MustIntToNumeric(i *big.Int) pgtype.Numeric

func MustNumericToInt

func MustNumericToInt(n pgtype.Numeric) *big.Int

func MustTimeToTimestamp added in v1.14.0

func MustTimeToTimestamp(t time.Time) pgtype.Timestamp

func MustUnixToTimestamp added in v1.14.0

func MustUnixToTimestamp(unix int64) pgtype.Timestamp

func NewLargeFloat

func NewLargeFloat() *big.Float

NewLargeFloat creates a new big.Float with a mantissa large enough to accurately represent the 256-bit integers used in Solidity.

func NumericToFloat

func NumericToFloat(n pgtype.Numeric) (*big.Float, error)

func NumericToInt

func NumericToInt(n pgtype.Numeric) (*big.Int, error)

func NumericToRat

func NumericToRat(n pgtype.Numeric) (*big.Rat, error)

func RatToNumeric

func RatToNumeric(r *big.Rat) (pgtype.Numeric, error)

func TimeToTimestamp added in v1.14.0

func TimeToTimestamp(t time.Time) (pgtype.Timestamp, error)

func UnixToTimestamp added in v1.14.0

func UnixToTimestamp(unix int64) (pgtype.Timestamp, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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