Documentation
¶
Index ¶
- type Money
- func (m Money) Add(add Money) Money
- func (m Money) AddFloat(add float64) Money
- func (m Money) AddInt(add int64) Money
- func (m Money) Divide(n int64) Money
- func (m Money) Format(f fmt.State, c rune)
- func (m Money) MarshalJSON() ([]byte, error)
- func (m Money) Sub(sub Money) Money
- func (m Money) SubFloat(sub float64) Money
- func (m Money) SubInt(sub int64) Money
- func (m Money) ToFloat() float64
- func (m Money) ToInt() int64
- func (m Money) ToString() string
- 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 a sum of money multiplied by precision (100). It can be negative Money is marshalled without multiplication:
- 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) ToString ¶
ToString 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.