package types import "errors" type Currency string const ( IRR Currency = "IRR" USD Currency = "USD" ) func StringCastToCurrency(s string) (Currency, error) { switch s { case "IRR": return IRR, nil case "USD": return USD, nil default: return IRR, errors.New("not a valid currency") } }