utils

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIntFromString

func NewIntFromString(number string) (i *big.Int, err error)

NewIntFromString returns a new math/big.Int from a string representation

func NewIntFromUint64

func NewIntFromUint64(number uint64) (i *big.Int)

NewIntFromUint64 returns a new big.Int from a uint64 representation

func RequireIntFromString

func RequireIntFromString(number string) *big.Int

RequireIntFromString returns a new big.Int from a string representation or panics if NewBigIntFromString would have returned an error.

Types

type BigInt

type BigInt big.Int

BigInt is an alias for math/big.Int, for use with Swagger generated code. Even though it has some corresponding methods, convert it as soon as possible into big.Int.

func (*BigInt) Cmp

func (b *BigInt) Cmp(i *BigInt) int

Cmp compares two BigInts just like big.Int

func (*BigInt) LargerOrEqualToZero

func (b *BigInt) LargerOrEqualToZero() bool

LargerOrEqualToZero checks that the number is >=0

func (*BigInt) LargerThanZero

func (b *BigInt) LargerThanZero() bool

LargerThanZero returns true if it is >0

func (BigInt) MarshalJSON

func (b BigInt) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*BigInt) Set

func (b *BigInt) Set(i *big.Int) *BigInt

Set makes a BigInt equal to a given big.Int.

func (BigInt) String

func (b BigInt) String() string

String casts BigInt into big.Int and uses its String method.

func (*BigInt) UnmarshalJSON

func (b *BigInt) UnmarshalJSON(text []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*BigInt) Validate

func (b *BigInt) Validate(formats strfmt.Registry) error

Validate ensures that the BigInt's value is >= 0. The actual check does not need 'formats' from swagger, which is why Validate() wraps that function.

Jump to

Keyboard shortcuts

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