Skip to content
New issue

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

Add/Subtract multiple amounts together #74

Open
F21 opened this issue Nov 27, 2020 · 0 comments · May be fixed by #117
Open

Add/Subtract multiple amounts together #74

F21 opened this issue Nov 27, 2020 · 0 comments · May be fixed by #117

Comments

@F21
Copy link

F21 commented Nov 27, 2020

It would be nice if the Money struct has methods to add or subtract multiple values. For example:

func( *m Money) AddMultiple(om... *Money) (*Money, error){

}

func( *m Money) SubtractMultiple(om... *Money) (*Money, error){

}

I write a lot of test cases that calculates money and invoices and I often need to add up multiple values in a test case to check if the calculated amount is correct. It's possible to do this using the Add() method, but it's quite tedious to have to check the error for each addition. I am currently using a helper function to do this, but I think this would be a very useful addition to the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant