You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several methods to compare two Money object but there is no Money.Compare(Money) function.
The proposal is to add a Compare function for Money.
// Compare returns an integer comparing two Money objects// If Money objects are of different currency, an ErrCurrencyMismatch is returned.// If both objects are for same currency, their amounts are compared.// The result will be 0 if a == b, -1 if a < b, and +1 if a > b.func (m*Money) Compare(om*Money) int {
iferr:=m.assertSameCurrency(om); err!=nil {
returnfalse, err
}
returnm.compare(om), nil
}
I'll provide a PR.
The text was updated successfully, but these errors were encountered:
There are several methods to compare two Money object but there is no
Money.Compare(Money)
function.The proposal is to add a Compare function for Money.
I'll provide a PR.
The text was updated successfully, but these errors were encountered: