aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeng-Ying Yang <garfield@dexon.org>2018-12-26 14:51:41 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commitd216c88641b4a9f8218bb26f6596ababd7625658 (patch)
tree6c564f5ab469e2dc37e7a0f4d2fe638ddda6dce5
parentb58b4841917e67387aa7338c67f879933a3f9b65 (diff)
downloaddexon-d216c88641b4a9f8218bb26f6596ababd7625658.tar.gz
dexon-d216c88641b4a9f8218bb26f6596ababd7625658.tar.zst
dexon-d216c88641b4a9f8218bb26f6596ababd7625658.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.go6
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) }