diff options
author | Meng-Ying Yang <garfield@dexon.org> | 2018-12-26 14:51:41 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2018-12-28 14:15:39 +0800 |
commit | bc18f6b29086e1a98590d41b2c1e362505af49aa (patch) | |
tree | 7379ccc2fc79f8f210cbe556d95694a239aed99d | |
parent | 61c39fb69fcd3ff4bef350cbde150805c6e85bac (diff) | |
download | dexon-bc18f6b29086e1a98590d41b2c1e362505af49aa.tar.gz dexon-bc18f6b29086e1a98590d41b2c1e362505af49aa.tar.zst dexon-bc18f6b29086e1a98590d41b2c1e362505af49aa.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
-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) } |