mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-22 00:25:43 +00:00
feat: add currencies XAG and XAU (#535)
* Added currencies XAG and XAU to currency.ts
I added XAG and XAU for myself and others who prefer to measure value with something of substance.
Review the ISO 4217 standard to view a full list of official currency codes including the ones I have added.
https://www.iso.org/iso-4217-currency-codes.html
https://en.wikipedia.org/wiki/ISO_4217
Example:
https://www.xe.com/currencyconverter/convert/?Amount=100&From=XAG&To=USD
API for exchange rates:
https://openexchangerates.org/
* Added field values xag and xau to group.go
* Update group.go
Former-commit-id: 5438898b49
This commit is contained in:
parent
be8d6e8235
commit
0b021e898f
3 changed files with 9 additions and 1 deletions
|
@ -160,6 +160,8 @@ const (
|
||||||
CurrencyThb Currency = "thb"
|
CurrencyThb Currency = "thb"
|
||||||
CurrencyTry Currency = "try"
|
CurrencyTry Currency = "try"
|
||||||
CurrencyUsd Currency = "usd"
|
CurrencyUsd Currency = "usd"
|
||||||
|
CurrencyXag Currency = "xag"
|
||||||
|
CurrencyXau Currency = "xau"
|
||||||
CurrencyZar Currency = "zar"
|
CurrencyZar Currency = "zar"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -170,7 +172,7 @@ func (c Currency) String() string {
|
||||||
// CurrencyValidator is a validator for the "currency" field enum values. It is called by the builders before save.
|
// CurrencyValidator is a validator for the "currency" field enum values. It is called by the builders before save.
|
||||||
func CurrencyValidator(c Currency) error {
|
func CurrencyValidator(c Currency) error {
|
||||||
switch c {
|
switch c {
|
||||||
case CurrencyAed, CurrencyAud, CurrencyBgn, CurrencyBrl, CurrencyCad, CurrencyChf, CurrencyCny, CurrencyCzk, CurrencyDkk, CurrencyEur, CurrencyGbp, CurrencyHkd, CurrencyIdr, CurrencyInr, CurrencyJpy, CurrencyKrw, CurrencyMxn, CurrencyNok, CurrencyNzd, CurrencyPln, CurrencyRmb, CurrencyRon, CurrencyRub, CurrencySar, CurrencySek, CurrencySgd, CurrencyThb, CurrencyTry, CurrencyUsd, CurrencyZar:
|
case CurrencyAed, CurrencyAud, CurrencyBgn, CurrencyBrl, CurrencyCad, CurrencyChf, CurrencyCny, CurrencyCzk, CurrencyDkk, CurrencyEur, CurrencyGbp, CurrencyHkd, CurrencyIdr, CurrencyInr, CurrencyJpy, CurrencyKrw, CurrencyMxn, CurrencyNok, CurrencyNzd, CurrencyPln, CurrencyRmb, CurrencyRon, CurrencyRub, CurrencySar, CurrencySek, CurrencySgd, CurrencyThb, CurrencyTry, CurrencyUsd, CurrencyXag, CurrencyXau, CurrencyZar:
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("group: invalid enum value for currency field: %q", c)
|
return fmt.Errorf("group: invalid enum value for currency field: %q", c)
|
||||||
|
|
|
@ -58,6 +58,8 @@ func (Group) Fields() []ent.Field {
|
||||||
"thb",
|
"thb",
|
||||||
"try",
|
"try",
|
||||||
"usd",
|
"usd",
|
||||||
|
"xag",
|
||||||
|
"xau",
|
||||||
"zar",
|
"zar",
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ export type Codes =
|
||||||
| "THB"
|
| "THB"
|
||||||
| "TRY"
|
| "TRY"
|
||||||
| "USD"
|
| "USD"
|
||||||
|
| "XAG"
|
||||||
|
| "XAU"
|
||||||
| "ZAR";
|
| "ZAR";
|
||||||
|
|
||||||
export type Currency = {
|
export type Currency = {
|
||||||
|
@ -65,5 +67,7 @@ export const currencies: Currency[] = [
|
||||||
{ code: "THB", local: "Thailand", symbol: "฿", name: "Thai Baht" },
|
{ code: "THB", local: "Thailand", symbol: "฿", name: "Thai Baht" },
|
||||||
{ code: "TRY", local: "Turkey", symbol: "₺", name: "Turkish Lira" },
|
{ code: "TRY", local: "Turkey", symbol: "₺", name: "Turkish Lira" },
|
||||||
{ code: "USD", local: "United States", symbol: "$", name: "United States Dollar" },
|
{ code: "USD", local: "United States", symbol: "$", name: "United States Dollar" },
|
||||||
|
{ code: "XAG", local: "Global", symbol: "XAG", name: "Silver Troy Ounce" },
|
||||||
|
{ code: "XAU", local: "Global", symbol: "XAU", name: "Gold Troy Ounce" },
|
||||||
{ code: "ZAR", local: "South Africa", symbol: "R", name: "South African Rand" },
|
{ code: "ZAR", local: "South Africa", symbol: "R", name: "South African Rand" },
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue