diff options
author | Meng-Ying Yang <garfield@dexon.org> | 2018-12-26 14:51:41 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:55 +0800 |
commit | 509c6899caad7a66f7e64a1ef9718daa9018f7f1 (patch) | |
tree | 7c1c40f5b8953deac0e14dcde5326b2f8b1f920e /common/big.go | |
parent | 0f51629cd2dd0beabd809787453d041ea0d1a25c (diff) | |
download | dexon-509c6899caad7a66f7e64a1ef9718daa9018f7f1.tar dexon-509c6899caad7a66f7e64a1ef9718daa9018f7f1.tar.gz dexon-509c6899caad7a66f7e64a1ef9718daa9018f7f1.tar.bz2 dexon-509c6899caad7a66f7e64a1ef9718daa9018f7f1.tar.lz dexon-509c6899caad7a66f7e64a1ef9718daa9018f7f1.tar.xz dexon-509c6899caad7a66f7e64a1ef9718daa9018f7f1.tar.zst dexon-509c6899caad7a66f7e64a1ef9718daa9018f7f1.zip |
common: add utilities for Big type (#104)
- Add String() for common usage which call original `big.Int`'s `String()`
- Add ToBigInt() for type convertion
Diffstat (limited to 'common/big.go')
-rw-r--r-- | common/big.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/big.go b/common/big.go index dcc5269a7..ea3d4aba6 100644 --- a/common/big.go +++ b/common/big.go @@ -63,3 +63,9 @@ func (b Big) Value() (driver.Value, error) { b2 := big.Int(b) return (&b2).String(), nil } + +// String returns decimal value in string type. +func (b *Big) String() string { return (*big.Int)(b).String() } + +// BigInt convert common.Big to big.Int. +func (b *Big) BigInt() *big.Int { return (*big.Int)(b) } |