Documentation
¶
Index ¶
- Constants
- Variables
- type Amount
- func (am *Amount) Add(b *Amount) *Amount
- func (am *Amount) Clone() *Amount
- func (am *Amount) Div(b *Amount) *Amount
- func (am *Amount) DivC(b int64) *Amount
- func (am *Amount) Equal(b *Amount) bool
- func (am *Amount) IsZero() bool
- func (am *Amount) Less(b *Amount) bool
- func (am *Amount) MarshalJSON() ([]byte, error)
- func (am *Amount) Mul(b *Amount) *Amount
- func (am *Amount) MulC(b int64) *Amount
- func (am *Amount) ReadFrom(r io.Reader) (int64, error)
- func (am *Amount) String() string
- func (am *Amount) Sub(b *Amount) *Amount
- func (am *Amount) UnmarshalJSON(bs []byte) error
- func (am *Amount) WriteTo(w io.Writer) (int64, error)
Constants ¶
View Source
const FractionalCount = 18
FractionalCount represent the number of under the float point
View Source
const FractionalMax = 1000000000000000000
FractionalMax represent the max value of under the float point
Variables ¶
View Source
var COIN = NewCoinAmount(1, 0)
COIN is 1 coin
View Source
var (
ErrInvalidAmountFormat = errors.New("invalid amount format")
)
amount errors
Functions ¶
This section is empty.
Types ¶
type Amount ¶
Amount is the precision float value based on the big.Int
func NewAmountFromBytes ¶
NewAmountFromBytes parse the amount from the byte array
func NewCoinAmount ¶
NewCoinAmount returns the amount that is consisted of the integer and the fractional value
func ParseAmount ¶
ParseAmount parse the amount from the float string
func (*Amount) MarshalJSON ¶
MarshalJSON is a marshaler function
func (*Amount) UnmarshalJSON ¶
UnmarshalJSON is a unmarshaler function
Click to show internal directories.
Click to hide internal directories.