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 13:49:59 +0800 |
commit | a035d5f3d4c7f21e872e8d61ad82d92e2f2b0dbc (patch) | |
tree | 750376590fe53d505d514c0f53434ff779b8901a /common | |
parent | 8be317885f3cbd2acf35173e4b1a473eb3f058d6 (diff) | |
download | dexon-a035d5f3d4c7f21e872e8d61ad82d92e2f2b0dbc.tar.gz dexon-a035d5f3d4c7f21e872e8d61ad82d92e2f2b0dbc.tar.zst dexon-a035d5f3d4c7f21e872e8d61ad82d92e2f2b0dbc.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')
-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) } |