money

package
v0.0.0-...-abea9b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bank

type Bank struct {
	// contains filtered or unexported fields
}

func NewBank

func NewBank() Bank

func (Bank) AddRate

func (bank Bank) AddRate(from string, to string, rate int)

func (Bank) Reduce

func (bank Bank) Reduce(source Expression, toCurrency string) Money

type Expression

type Expression interface {
	Reduce(bank Bank, currency string) Money
	Plus(addend Expression) Expression
	Times(multiplier int) Expression
}

type Money

type Money struct {
	// contains filtered or unexported fields
}

func Dollar

func Dollar(amount int) Money

func Franc

func Franc(amount int) Money

func (Money) Equal

func (money Money) Equal(other Money) bool

func (Money) Plus

func (money Money) Plus(other Expression) Expression

func (Money) Reduce

func (money Money) Reduce(bank Bank, toCurrency string) Money

func (Money) String

func (money Money) String() string

func (Money) Times

func (money Money) Times(n int) Expression

type Sum

type Sum struct {
	// contains filtered or unexported fields
}

func (Sum) Plus

func (sum Sum) Plus(addend Expression) Expression

func (Sum) Reduce

func (sum Sum) Reduce(bank Bank, currency string) Money

func (Sum) Times

func (sum Sum) Times(multiplier int) Expression

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL