func (currencies currencies) CurrencyByCode(code string) (currency, bool) {
	for _, c := range currencies {
		if string(c.code) == code {
			return c, true
		}
	}
	return currency{}, false
}
CurrencyByCode gets currency by code
package currency
import (
	"database/sql/driver"
	"encoding/json"
	"fmt"
)
type Country string
func (country Country) Value() (value driver.Value, err error) {
	if country == "" {
		return "", nil
	}
	if err = country.Validate(); err != nil {
		return nil, err
	}
	return country.String(), nil
}
func (country *Country) UnmarshalJSON(data []byte) error {
	var str string
	if err := json.Unmarshal(data, &str); err != nil {
		return err
	}
	_, err := ByCountryStrErr(str)
	if err != nil {
		return err
	}
	*country = Country(str)
	return nil
}
func (country Country) Validate() error {
	if _, ok := ByCountryStr(string(country)); !ok {
		return fmt.Errorf("'%s' is not valid ISO-4217 country", country)
	}
	return nil
}
func (country Country) IsSet() bool {
	return len(string(country)) > 0
}
func (country Country) String() string {
	return string(country)
}
type Countries []Country
func (countries Countries) IsCountryIn(country string) bool {
	for _, c := range countries {
		if string(c) == country {
			return true
		}
	}
	return false
}
type Currency string
func (currency Currency) Value() (value driver.Value, err error) {
	if currency == "" {
		return "", nil
	}
	if err = currency.Validate(); err != nil {
		return nil, err
	}
	return currency.String(), nil
}
func (currency *Currency) UnmarshalJSON(data []byte) error {
	var str string
	if err := json.Unmarshal(data, &str); err != nil {
		return err
	}
	currencyValue, err := ByCurrencyStrErr(str)
	if err != nil {
		return err
	}
	*currency = currencyValue.Currency()
	return nil
}
func (currency Currency) Validate() error {
	if _, ok := ByCurrencyStr(string(currency)); !ok {
		return fmt.Errorf("'%s' is not valid ISO-4217 currency", currency)
	}
	return nil
}
func (currency Currency) IsSet() bool {
	return len(string(currency)) > 0
}
func (currency Currency) String() string {
	return string(currency)
}
type Code string
func (code Code) Value() (value driver.Value, err error) {
	if code == "" {
		return "", nil
	}
	if err = code.Validate(); err != nil {
		return nil, err
	}
	return code.String(), nil
}
func (code *Code) UnmarshalJSON(data []byte) error {
	var str string
	if err := json.Unmarshal(data, &str); err != nil {
		return err
	}
	currency, err := ByCodeStrErr(str)
	if err != nil {
		return err
	}
	*code = currency.Code()
	return nil
}
func (code Code) Validate() error {
	if _, ok := ByCodeStr(string(code)); !ok {
		return fmt.Errorf("'%s' is not valid ISO-4217 code", code)
	}
	return nil
}
func (code Code) IsSet() bool {
	return len(string(code)) > 0
}
func (code Code) String() string {
	return string(code)
}
func (code Code) Places() int {
	return currenciesByCode[string(code)].decimalPlaces
}
type Number string
func (number Number) Value() (value driver.Value, err error) {
	if number == "" {
		return "", nil
	}
	if err = number.Validate(); err != nil {
		return nil, err
	}
	return number.String(), nil
}
func (number *Number) UnmarshalJSON(data []byte) error {
	var str string
	if err := json.Unmarshal(data, &str); err != nil {
		return err
	}
	currency, err := ByNumberStrErr(str)
	if err != nil {
		return err
	}
	*number = currency.Number()
	return nil
}
func (number Number) Validate() error {
	if _, ok := ByNumberStr(string(number)); !ok {
		return fmt.Errorf("'%s' is not valid ISO-4217 number", number)
	}
	return nil
}
func (number Number) IsSet() bool {
	return len(string(number)) > 0
}
func (number Number) String() string {
	return string(number)
}
type currency struct {
	countries     Countries
	currency      Currency
	code          Code
	number        Number
	decimalPlaces int
}
type currencies []currency
func (currencies currencies) CurrencyByCurrency(curr string) (currency, bool) {
	for _, c := range currencies {
		if string(c.currency) == curr {
			return c, true
		}
	}
	return currency{}, false
}