Files
ana-ledger/ledger/delta.go
2023-10-24 06:19:26 -06:00

35 lines
569 B
Go

package ledger
type Currency string
const (
USD = Currency("$")
)
type Delta struct {
Date string
Account string
Value float64
Currency Currency
Description string
}
func newDelta(d, desc, acc string, v float64, c string) Delta {
return Delta{
Date: d,
Account: acc,
Value: v,
Currency: Currency(c),
Description: desc,
}
}
func (delta Delta) Plus(other Delta) Delta {
return Delta{
Date: other.Date,
Account: delta.Account,
Value: delta.Value + other.Value,
Currency: other.Currency,
}
}