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 { Balance Balance `firestore:"balance,noindex,omitempty,noindex" json:"balance,omitempty"` LastTransferID string `datastore:"lastTransferID,omitempty,noindex" json:"lastTransferID,omitempty"` LastTransferAt time.Time `datastore:"lastTransferAt,omitempty,noindex" json:"lastTransferAt,omitempty"` // Do not remove, needed to hide a balance/history menu in Telegram CountOfTransfers int `datastore:"countOfTransfers,omitempty" json:"countOfTransfers,omitempty"` }
Balanced is a struct to store balance and summary of transfers ffjson: skip
func (*Balanced) AddToBalance ¶
func (v *Balanced) AddToBalance(currency CurrencyCode, value decimal.Decimal64p2)
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.