Documentation ¶
Index ¶
- Variables
- func AreEquals(l, r pb.Money) bool
- func AreSameCurrency(l, r pb.Money) bool
- func IsNegative(m pb.Money) bool
- func IsPositive(m pb.Money) bool
- func IsValid(m pb.Money) bool
- func IsZero(m pb.Money) bool
- func MultiplySlow(m pb.Money, n uint32) pb.Money
- func Must(v pb.Money, err error) pb.Money
- func Negate(m pb.Money) pb.Money
- func Sum(l, r pb.Money) (pb.Money, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidValue = errors.New("one of the specified money values is invalid") ErrMismatchingCurrency = errors.New("mismatching currency codes") )
Functions ¶
func AreEquals ¶
AreEquals returns true if values l and r are the equal, including the currency. This does not check validity of the provided values.
func AreSameCurrency ¶
AreSameCurrency returns true if values l and r have a currency code and they are the same values.
func IsNegative ¶
IsNegative returns true if the specified money value is valid and is negative.
func IsPositive ¶
IsPositive returns true if the specified money value is valid and is positive.
func MultiplySlow ¶
MultiplySlow is a slow multiplication operation done through adding the value to itself n-1 times.
func Must ¶
Must panics if the given error is not nil. This can be used with other functions like: "m := Must(Sum(a,b))".
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.