From e0f7ce1279a832240576e52f2417e82e3d4fc8eb Mon Sep 17 00:00:00 2001 From: Meng-Ying Yang Date: Wed, 26 Dec 2018 14:51:41 +0800 Subject: common: add utilities for Big type (#104) - Add String() for common usage which call original `big.Int`'s `String()` - Add ToBigInt() for type convertion --- common/big.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'common') 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) } -- cgit