Documentation ¶
Overview ¶
Package api contains all the background functions, types and constants To parse command line arguments and create invoices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // GreatBritishPound (const) GreatBritishPound = Currency{"GBP", "£"} // UnitedStatesDollar (const) UnitedStatesDollar = Currency{"USD", "$"} // ZeroCurrency (const): An empty Currency To use as a default ZeroCurrency = Currency{} // Currencies (const) Currencies = map[*Currency]struct{}{ &GreatBritishPound: {}, &UnitedStatesDollar: {}, &ZeroCurrency: {}, } CheckIfMoney = regexp.MustCompile("([A-Z]{3} ?|^\\W)\\d+\\.?\\d*") )
Functions ¶
This section is empty.
Types ¶
type Bank ¶
type Contact ¶
type Date ¶
type Invoice ¶
type Invoice struct { Number uint From *Contact To *Contact Items *Items Bank *Bank InvoiceDate *Date DueDate *Date }
type KeyValueFlags ¶
type Money ¶
func ParseMoney ¶
ParseMoney parses a string To Money.
The string can either be in the format:
// Using the abbreviation GBP 10.00
Or:
// Using the symbol £10.00
func ToMoney ¶
ToMoney converts a float64 To Money e.g. 1.23 To 1.23, 1.345 To 1.35 depending on what Currency is given.
func (*Money) Multiply ¶
Multiply safely multiplies a Money value by a float64, rounding To the nearest cent.
func (*Money) String ¶
String returns a formatted Money value with the currency's symbol and its abbreviation.
func (*Money) StringAbbr ¶
StringAbbr returns a formatted Money value with the currency's abbreviated type.
func (*Money) StringSymbol ¶
StringSymbol returns a formatted Money value with the currency's symbol.
Click to show internal directories.
Click to hide internal directories.