Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type BigInt big.Int
- // String casts BigInt into big.Int and uses its String method.
- func (b *BigInt) String() string {
- bc := big.Int(*b)
- return bc.String()
- }
- // UnmarshalJSON casts BigInt into big.Int and uses its UnmarshalJSON method.
- func (b *BigInt) UnmarshalJSON(text []byte) error {
- bc := new(big.Int)
- err := bc.UnmarshalJSON(text)
- if err != nil {
- return err
- }
- b = b.Set(bc)
- return nil
- }
- // Set is different from big.Int.Set() in that you must use the value it returns
- func (b *BigInt) Set(i *big.Int) *BigInt {
- iB := BigInt(*i)
- b = &iB
- return b
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement