Rhymond/go-money

Add/Subtract multiple amounts together

F21 opened this issue · 0 comments

F21 commented

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.