Documentation
¶
Index ¶
- Constants
- func BytesToInt64(bytes []byte) int64
- func FloatToNumeric(f *big.Float) (pgtype.Numeric, error)
- func Int64ToBytes(i int64) []byte
- func IntToNumeric(i *big.Int) (pgtype.Numeric, error)
- func MapValsToArr[T comparable, U any](m map[T]U) []U
- func MustFloatToNumeric(f *big.Float) pgtype.Numeric
- func MustIntToNumeric(i *big.Int) pgtype.Numeric
- func MustNumericToInt(n pgtype.Numeric) *big.Int
- func MustTimeToTimestamp(t time.Time) pgtype.Timestamp
- func MustUnixToTimestamp(unix int64) pgtype.Timestamp
- func NewLargeFloat() *big.Float
- func NumericToFloat(n pgtype.Numeric) (*big.Float, error)
- func NumericToInt(n pgtype.Numeric) (*big.Int, error)
- func NumericToRat(n pgtype.Numeric) (*big.Rat, error)
- func RatToNumeric(r *big.Rat) (pgtype.Numeric, error)
- func TimeToTimestamp(t time.Time) (pgtype.Timestamp, error)
- func UnixToTimestamp(unix int64) (pgtype.Timestamp, error)
Constants ¶
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 FloatToNumeric ¶
FloatToNumeric converts a big.Float to pgtype.Numeric.
func Int64ToBytes ¶ added in v1.3.0
func IntToNumeric ¶
IntToNumeric converts a big.Int to pgtype.Numeric.
func MapValsToArr ¶
func MapValsToArr[T comparable, U any](m map[T]U) []U
func MustFloatToNumeric ¶
MustFloatToNumeric converts a big.Float to pgtype.Numeric and panics on error.
func MustIntToNumeric ¶
MustIntToNumeric converts a big.Int to pgtype.Numeric and panics on error.
func MustNumericToInt ¶
MustNumericToInt converts a pgtype.Numeric to a big.Int and panics on error.
func MustUnixToTimestamp ¶ added in v1.14.0
func NewLargeFloat ¶
NewLargeFloat creates a new big.Float with a mantissa large enough to accurately represent the 256-bit integers used in Solidity.
func NumericToFloat ¶
NumericToFloat converts a pgtype.Numeric to a big.Float.
func NumericToInt ¶
NumericToInt converts a pgtype.Numeric to a big.Int, ensuring denominator is non-zero.
func NumericToRat ¶
NumericToRat converts a pgtype.Numeric to a big.Rat.
func RatToNumeric ¶
RatToNumeric converts a big.Rat to pgtype.Numeric with precision.
Types ¶
This section is empty.