Documentation
¶
Index ¶
- type Money
- func (m Money) Add(add Money) Money
- func (m Money) Ceil() Money
- func (m Money) Div(n int64) Money
- func (m Money) Float() float64
- func (m Money) Floor() Money
- func (m Money) Format(f fmt.State, c rune)
- func (m Money) Int() int64
- func (m Money) MarshalJSON() ([]byte, error)
- func (m Money) Round() Money
- func (m Money) String() string
- func (m Money) Sub(sub Money) Money
- func (m *Money) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Money ¶
type Money int64
Money is an amount with precision 2
- FromInt(15) -> 15
- FromFloat(15.07) -> 15.07
- FromFloat(-15.073) -> -15.07
- FromFloat(15.078) -> 15.07
func (Money) Format ¶
Format implements 'fmt.Formatter' interface. It divides a number in groups of three didits separated by thin space
func (Money) MarshalJSON ¶
func (Money) String ¶ added in v0.6.0
String converts Money to string. Money is always formatted as a number with 2 digits after decimal point (123.45, 123.00 and etc.)
func (*Money) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.