Documentation
¶
Index ¶
- Constants
- Variables
- func HasCurrencyPrefix(s string) bool
- func IsKnownCurrency(c CurrencyCode) bool
- type Amount
- type Balance
- func (b Balance) Add(amount Amount) Balance
- func (b Balance) CommaSeparatedUnsignedWithSymbols(translator interface{ ... }) string
- func (b Balance) Equal(b2 Balance) bool
- func (b Balance) IsZero() bool
- func (b Balance) OnlyNegative() Balance
- func (b Balance) OnlyPositive() Balance
- func (b Balance) Reversed() (reversed Balance)
- type Balanced
- type CurrencyCode
- type TestStruct
Constants ¶
View Source
const ( CurrencySymbolEUR = "€" CurrencySymbolUSD = "$" CurrencySymbolGPB = "£" CurrencySymbolJPY = "¥" CurrencySymbolRUR = "₽" CurrencySymbolIRR = "﷼" CurrencySymbolUAH = "₴" CurrencySymbolUZS = "сўм" CurrencySymbolBYN = "Br" CurrencySymbolTJS = "смн." CurrencySymbolKZT = "₸" )
Variables ¶
View Source
var CurrencyBYN = CurrencyCode("BYN")
View Source
var CurrencyEUR = CurrencyCode("EUR")
View Source
var CurrencyGBP = CurrencyCode("GPB")
View Source
var CurrencyIRR = CurrencyCode("IRR")
View Source
var CurrencyJPY = CurrencyCode("JPY")
View Source
var CurrencyKZT = CurrencyCode("KZT")
View Source
var CurrencyRUB = CurrencyCode("RUB")
View Source
var CurrencyTJS = CurrencyCode("TJS")
View Source
var CurrencyUAH = CurrencyCode("UAH")
View Source
var CurrencyUSD = CurrencyCode("USD")
View Source
var CurrencyUZS = CurrencyCode("UZS")
Functions ¶
func HasCurrencyPrefix ¶
func IsKnownCurrency ¶ added in v0.1.0
func IsKnownCurrency(c CurrencyCode) bool
Types ¶
type Amount ¶
type Amount struct { Currency CurrencyCode `json:"currency" firestore:"currency"` Value decimal.Decimal64p2 `json:"value" firestore:"value"` }
Amount holds amount of money with currency
func NewAmount ¶
func NewAmount(currency CurrencyCode, value decimal.Decimal64p2) Amount
NewAmount creates new amount
type Balance ¶
type Balance map[CurrencyCode]decimal.Decimal64p2
func (Balance) CommaSeparatedUnsignedWithSymbols ¶
func (Balance) OnlyNegative ¶
func (Balance) OnlyPositive ¶
type Balanced ¶
type Balanced struct { BalanceJson string `datastore:",noindex,omitempty" json:",omitempty"` LastTransferID string `datastore:",noindex,omitempty" json:",omitempty"` LastTransferAt time.Time `datastore:",noindex,omitempty"` // `json:",omitempty"` - http://stackoverflow.com/questions/32643815/golang-json-omitempty-with-time-time-field CountOfTransfers int `datastore:",omitempty" json:",omitempty"` // Do not remove, need for hiding balance/history menu in Telegram BalanceCount int `datastore:",noindex,omitempty" json:"-"` }
ffjson: skip
func (*Balanced) AddToBalance ¶
func (balanced *Balanced) AddToBalance(currency CurrencyCode, value decimal.Decimal64p2) (Balance, error)
func (*Balanced) SetBalance ¶
type CurrencyCode ¶ added in v0.1.0
type CurrencyCode string
func CleanupCurrency ¶
func CleanupCurrency(s string) CurrencyCode
func (CurrencyCode) IsMoney ¶ added in v0.1.0
func (c CurrencyCode) IsMoney() bool
func (CurrencyCode) Sign ¶ added in v0.1.0
func (c CurrencyCode) Sign() string
func (CurrencyCode) SignAndCode ¶ added in v0.1.0
func (c CurrencyCode) SignAndCode() string
type TestStruct ¶
Click to show internal directories.
Click to hide internal directories.