aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeng-Ying Yang <garfield@dexon.org>2018-12-26 14:51:41 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:20 +0800
commite0f7ce1279a832240576e52f2417e82e3d4fc8eb (patch)
tree88d35f6e5b488f337cb2e5477c12b3af0a4ed7bc
parenta96cea486d4a74b7bd8ada1f004b219e7d8203c4 (diff)
downloadgo-tangerine-e0f7ce1279a832240576e52f2417e82e3d4fc8eb.tar
go-tangerine-e0f7ce1279a832240576e52f2417e82e3d4fc8eb.tar.gz
go-tangerine-e0f7ce1279a832240576e52f2417e82e3d4fc8eb.tar.bz2
go-tangerine-e0f7ce1279a832240576e52f2417e82e3d4fc8eb.tar.lz
go-tangerine-e0f7ce1279a832240576e52f2417e82e3d4fc8eb.tar.xz
go-tangerine-e0f7ce1279a832240576e52f2417e82e3d4fc8eb.tar.zst
go-tangerine-e0f7ce1279a832240576e52f2417e82e3d4fc8eb.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) }