Versions in this module Expand all Collapse all v1 v1.0.1 Aug 13, 2023 v1.0.0 Aug 13, 2023 Changes in this version + var BigIntCalculator = calculator.NewCalculator[*big.Int](bigcalc.Calculator{}) + var ErrNonDecimalCurrency = errors.New("non-decimal currency") + var IntCalculator = calculator.NewCalculator[int](integer.Calculator{}) type Dinero + Calculator calculator.Calculator[T] + func NewBigDinero(amount int64, currency currency.Currency[*big.Int]) Dinero[*big.Int] + func NewBigDineroWithScale(amount int64, currency currency.Currency[*big.Int], scale int64) Dinero[*big.Int] + func (d *Dinero[T]) WithCalculator(calculator calculator.Calculator[T]) Dinero[T] + func (d Dinero[T]) ToDecimal(options ...Option[T]) (string, error) + type Option func(*Options[T]) + func WithTransformer(t Transformer[T]) Option[T] + type Options struct + type Transformer func(value string, currency currency.Currency[T]) string v0 v0.1.1 May 11, 2023 Changes in this version + func HaveSameAmount(dineros ...Dinero[T]) bool + func HaveSameCurrency(dineros ...Dinero[T]) bool + type Dinero struct + Amount T + Currency currency.Currency[T] + Scale T + func Maximum(dineros ...Dinero[T]) (Dinero[T], error) + func Minimum(dineros ...Dinero[T]) (Dinero[T], error) + func NewDinero(amount int, currency currency.Currency[int]) Dinero[int] + func NewDineroWithOptions(amount T, currency currency.Currency[T], scale T, ...) Dinero[T] + func NewDineroWithScale(amount int, currency currency.Currency[int], scale int) Dinero[int] + func NormalizeScale(dineros ...Dinero[T]) []Dinero[T] + func (d Dinero[T]) Add(addend Dinero[T]) (Dinero[T], error) + func (d Dinero[T]) Allocate(ratios ...T) ([]Dinero[T], error) + func (d Dinero[T]) AllocateScaled(ratios ...ScaledAmount[T]) ([]Dinero[T], error) + func (d Dinero[T]) Compare(comparator Dinero[T]) (calculator.CompareResult, error) + func (d Dinero[T]) Convert(currency currency.Currency[T], rates map[string]ScaledAmount[T]) (Dinero[T], error) + func (d Dinero[T]) Equal(comparator Dinero[T]) bool + func (d Dinero[T]) GreaterThan(dinero Dinero[T]) bool + func (d Dinero[T]) GreaterThanOrEqual(dinero Dinero[T]) bool + func (d Dinero[T]) HasSubUnits() bool + func (d Dinero[T]) IsNegative() bool + func (d Dinero[T]) IsPositive() bool + func (d Dinero[T]) IsZero() bool + func (d Dinero[T]) LessThan(dinero Dinero[T]) bool + func (d Dinero[T]) LessThanOrEqual(dinero Dinero[T]) bool + func (d Dinero[T]) Multiply(multiplier T) (Dinero[T], error) + func (d Dinero[T]) MultiplyScaled(multiplier ScaledAmount[T]) (Dinero[T], error) + func (d Dinero[T]) Subtract(subtrahend Dinero[T]) (Dinero[T], error) + func (d Dinero[T]) ToUnit() ([]T, error) + func (d Dinero[T]) TransformScale(newScale T, divider divide.Divider[T]) (Dinero[T], error) + func (d Dinero[T]) TrimScale() (Dinero[T], error) + type ScaledAmount struct + Amount T + Scale T + func NewScaledAmount(amount, scale T) ScaledAmount[T]