Documentation ¶
Overview ¶
Package pbmoney has utilities relating to Google's money.proto.
money.proto can be found at https://github.com/googleapis/googleapis/blob/master/google/type/money.proto, and the Go package for it is at https://godoc.org/google.golang.org/genproto/googleapis/type/Money.
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 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 ¶
var ( // ErrInvalidValue is returned if the specified money amount is not valid. ErrInvalidValue = errors.New("one of the specified money values is invalid") // ErrMismatchingCurrency is returned if two values don't have the same currency code. 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 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.