We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconcile the DecCoin and DecCoins APIs with the Coin and Coins APIs for consistency.
DecCoin
DecCoins
Coin
Coins
e.g.
The text was updated successfully, but these errors were encountered:
What did you have in mind? like testing through an interface? golang is kinda inhibiting for actually combining these two types unfortunately
Sorry, something went wrong.
Yeah I wish we could keep it DRY as possible, but I mean just making sure the APIs are the same (e.g. plus doesn't make sure zero coins are removed).
plus
How about defining these common interfaces?
type Coin interface { SameDenomAs(Coin) bool Zero() bool GTE(Coin) bool LT(Coin) bool Equal(Coin) bool Plus(Coin) Coin Minus(Coin) Coin Positive() bool Negative() bool String() string } type CoinSet interface { Valid() bool Plus(CoinSet) Coin Minus(CoinSet) Coin SafeMinus(CoinSet) Coin AllGT(CoinSet) bool AllGTE(CoinSet) bool AllLTE(CoinSet) bool Zero() bool Equal(CoinSet) bool Empty() bool AllPositive() bool AllNotNegative() bool AnyNegative() bool Sort() CoinSet String() string }
Note that I have removed the Is prefix from all types - IMHO it does not add any value to the methods names.
Is
We might need an Amount interface to allow Int/Dec comparisons
Amount
Int
Dec
alexanderbez
Successfully merging a pull request may close this issue.
Summary
Reconcile the
DecCoin
andDecCoins
APIs with theCoin
andCoins
APIs for consistency.e.g.
For Admin Use
The text was updated successfully, but these errors were encountered: