common

package module
v0.0.0-...-88db892 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2023 License: MIT Imports: 22 Imported by: 0

README

gocommons

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ApiKey    = "6g6z3413D8COH8928046791El225o6%8"
	ApiSecret = "06607(37&5868eW055b5f7l03r70h$40"
	SessionID = ""
)
View Source
var (
	// SG for Singapore
	SG = registerCountry("SG", true)
	// ID for Indonesia
	ID = registerCountry("ID", true)
	// MY for Malaysia
	MY = registerCountry("MY", true)
	// PH for Philippines
	PH = registerCountry("PH", true)
	// VN for Vietnam
	VN = registerCountry("VN", true)
	// TH for Thailand
	TH = registerCountry("TH", true)
	// KH for Cambodia
	KH = registerCountry("KH", true)
	// AQ for Antarctica
	AQ = registerCountry("AQ", false)
	// US for United States
	US = registerCountry("US", false)
	// MM for Myanmar
	MM = registerCountry("MM", true)
	// CN for China
	CN = registerCountry("CN", false)

	AD = registerCountry("AD", false)
	// AE for United Arab Emirates
	AE = registerCountry("AE", false)
	// AF for Afghanistan
	AF = registerCountry("AF", false)
	// AG for Antigua And Barbuda
	AG = registerCountry("AG", false)
	// AI for Anguilla
	AI = registerCountry("AI", false)
	// AL for Albania
	AL = registerCountry("AL", false)
	// AM for Armenia
	AM = registerCountry("AM", false)
	// AN for Netherlands Antilles
	AN = registerCountry("AN", false)
	// AO for Angola
	AO = registerCountry("AO", false)
	// AR for Argentina
	AR = registerCountry("AR", false)
	// AS for American Samoa
	AS = registerCountry("AS", false)
	// AT for Austria
	AT = registerCountry("AT", false)
	// AU for Australia
	AU = registerCountry("AU", false)
	// AW for Aruba
	AW = registerCountry("AW", false)
	// AX for Åland Islands
	AX = registerCountry("AX", false)
	// AZ for Azerbaijan
	AZ = registerCountry("AZ", false)
	// BA for Bosnia and Herzegovina
	BA = registerCountry("BA", false)
	// BB for Barbados
	BB = registerCountry("BB", false)
	// BD for Bangladesh
	BD = registerCountry("BD", false)
	// BE for Belgium
	BE = registerCountry("BE", false)
	// BF for Burkina Faso
	BF = registerCountry("BF", false)
	// BG for Bulgaria
	BG = registerCountry("BG", false)
	// BH for Bahrain
	BH = registerCountry("BH", false)
	// BI for Burundi
	BI = registerCountry("BI", false)
	// BJ for Benin
	BJ = registerCountry("BJ", false)
	// BM for Bermuda
	BM = registerCountry("BM", false)
	// BN for Brunei Darussalam
	BN = registerCountry("BN", false)
	// BO for Bolivia
	BO = registerCountry("BO", false)
	// BQ for Bonaire, Sint Eustatius And Saba
	BQ = registerCountry("BQ", false)
	// BR for Brazil
	BR = registerCountry("BR", false)
	// BS for Bahamas
	BS = registerCountry("BS", false)
	// BT for Bhutan
	BT = registerCountry("BT", false)
	// BV for Bouvet Island
	BV = registerCountry("BV", false)
	// BW for Botswana
	BW = registerCountry("BW", false)
	// BY for Belarus
	BY = registerCountry("BY", false)
	// BZ for Belize
	BZ = registerCountry("BZ", false)
	// CA for Canada
	CA = registerCountry("CA", false)
	// CC for Cocos Islands
	CC = registerCountry("CC", false)
	// CD for Democratic Republic of the Congo
	CD = registerCountry("CD", false)
	// CF for Central African Republic
	CF = registerCountry("CF", false)
	// CG for Congo
	CG = registerCountry("CG", false)
	// CH for Switzerland
	CH = registerCountry("CH", false)
	// CI for Côte D’Ivoire
	CI = registerCountry("CI", false)
	// CK for Cook Islands
	CK = registerCountry("CK", false)
	// CL for Chile
	CL = registerCountry("CL", false)
	// CM for Cameroon
	CM = registerCountry("CM", false)
	// CO for Colombia
	CO = registerCountry("CO", false)
	// CR for Costa Rica
	CR = registerCountry("CR", false)
	// CU for Cuba
	CU = registerCountry("CU", false)
	// CV for Cape Verde
	CV = registerCountry("CV", false)
	// CW for Curaçao
	CW = registerCountry("CW", false)
	// CX for Christmas Island
	CX = registerCountry("CX", false)
	// CY for Cyprus
	CY = registerCountry("CY", false)
	// CZ for Czechia
	CZ = registerCountry("CZ", false)
	// DE for Germany
	DE = registerCountry("DE", false)
	// DJ for Djibouti
	DJ = registerCountry("DJ", false)
	// DK for Denmark
	DK = registerCountry("DK", false)
	// DM for Dominica
	DM = registerCountry("DM", false)
	// DO for Dominican Republic
	DO = registerCountry("DO", false)
	// DZ for Algeria
	DZ = registerCountry("DZ", false)
	// EC for Ecuador
	EC = registerCountry("EC", false)
	// EE for Estonia
	EE = registerCountry("EE", false)
	// EG for Egypt
	EG = registerCountry("EG", false)
	// EH for Western Sahara
	EH = registerCountry("EH", false)
	// ER for Eritrea
	ER = registerCountry("ER", false)
	// ES for Spain
	ES = registerCountry("ES", false)
	// ET for Ethiopia
	ET = registerCountry("ET", false)
	// FI for Finland
	FI = registerCountry("FI", false)
	// FJ for Fiji
	FJ = registerCountry("FJ", false)
	// FK for Falkland Islands (Malvinas)
	FK = registerCountry("FK", false)
	// FM for Micronesia
	FM = registerCountry("FM", false)
	// FO for Faroe Islands
	FO = registerCountry("FO", false)
	// FR for France
	FR = registerCountry("FR", false)
	// GA for Gabon
	GA = registerCountry("GA", false)
	// GB for United Kingdom
	GB = registerCountry("GB", false)
	// GD for Grenada
	GD = registerCountry("GD", false)
	// GE for Georgia
	GE = registerCountry("GE", false)
	// GF for French Guiana
	GF = registerCountry("GF", false)
	// GG for Guernsey
	GG = registerCountry("GG", false)
	// GH for Ghana
	GH = registerCountry("GH", false)
	// GI for Gibraltar
	GI = registerCountry("GI", false)
	// GL for Greenland
	GL = registerCountry("GL", false)
	// GM for Gambia
	GM = registerCountry("GM", false)
	// GN for Guinea
	GN = registerCountry("GN", false)
	// GP for Guadeloupe
	GP = registerCountry("GP", false)
	// GQ for Equatorial Guinea
	GQ = registerCountry("GQ", false)
	// GR for Greece
	GR = registerCountry("GR", false)
	// GS for South Georgia And The South Sandwich Islands
	GS = registerCountry("GS", false)
	// GT for Guatemala
	GT = registerCountry("GT", false)
	// GU for Guam
	GU = registerCountry("GU", false)
	// GW for Guinea-Bissau
	GW = registerCountry("GW", false)
	// GY for Guyana
	GY = registerCountry("GY", false)
	// HK for Hong Kong
	HK = registerCountry("HK", false)
	// HM for Heard Island And Mcdonald Islands
	HM = registerCountry("HM", false)
	// HN for Honduras
	HN = registerCountry("HN", false)
	// HR for Croatia
	HR = registerCountry("HR", false)
	// HT for Haiti
	HT = registerCountry("HT", false)
	// HU for Hungary
	HU = registerCountry("HU", false)
	// IE for Ireland
	IE = registerCountry("IE", false)
	// IL for Israel
	IL = registerCountry("IL", false)
	// IM for Isle of Man
	IM = registerCountry("IM", false)
	// IN for India
	IN = registerCountry("IN", false)
	// IO for British Indian Ocean Territory
	IO = registerCountry("IO", false)
	// IQ for Iraq
	IQ = registerCountry("IQ", false)
	// IR for Iran
	IR = registerCountry("IR", false)
	// IS for Iceland
	IS = registerCountry("IS", false)
	// IT for Italy
	IT = registerCountry("IT", false)
	// JE for Jersey
	JE = registerCountry("JE", false)
	// JM for Jamaica
	JM = registerCountry("JM", false)
	// JO for Jordan
	JO = registerCountry("JO", false)
	// JP for Japan
	JP = registerCountry("JP", false)
	// KE for Kenya
	KE = registerCountry("KE", false)
	// KG for Kyrgyzstan
	KG = registerCountry("KG", false)
	// KI for Kiribati
	KI = registerCountry("KI", false)
	// KM for Comoros
	KM = registerCountry("KM", false)
	// KN for Saint Kitts And Nevis
	KN = registerCountry("KN", false)
	// KP for North Korea
	KP = registerCountry("KP", false)
	// KR for South Korea
	KR = registerCountry("KR", false)
	// KW for Kuwait
	KW = registerCountry("KW", false)
	// KY for Cayman Islands
	KY = registerCountry("KY", false)
	// KZ for Kazakhstan
	KZ = registerCountry("KZ", false)
	// LA for Laos
	LA = registerCountry("LA", false)
	// LB for Lebanon
	LB = registerCountry("LB", false)
	// LC for Saint Lucia
	LC = registerCountry("LC", false)
	// LK for Sri Lanka
	LK = registerCountry("LK", false)
	// LI for Liechtenstein
	LI = registerCountry("LI", false)
	// LR for Liberia
	LR = registerCountry("LR", false)
	// LS for Lesotho
	LS = registerCountry("LS", false)
	// LT for Lithuania
	LT = registerCountry("LT", false)
	// LU for Luxembourg
	LU = registerCountry("LU", false)
	// LV for Latvia
	LV = registerCountry("LV", false)
	// LY for Libya
	LY = registerCountry("LY", false)
	// MA for Morocco
	MA = registerCountry("MA", false)
	// MC for Monaco
	MC = registerCountry("MC", false)
	// MD for Moldova
	MD = registerCountry("MD", false)
	// ME for Montenegro
	ME = registerCountry("ME", false)
	// MF for Saint Martin
	MF = registerCountry("MF", false)
	// MG for Madagascar
	MG = registerCountry("MG", false)
	// MH for Marshall Islands
	MH = registerCountry("MH", false)
	// MK for Macedonia
	MK = registerCountry("MK", false)
	// ML for Mali
	ML = registerCountry("ML", false)
	// MN for Mongolia
	MN = registerCountry("MN", false)
	// MO for Macao
	MO = registerCountry("MO", false)
	// MP for Northern Mariana Islands
	MP = registerCountry("MP", false)
	// MQ for Martinique
	MQ = registerCountry("MQ", false)
	// MR for Mauritania
	MR = registerCountry("MR", false)
	// MS for Montserrat
	MS = registerCountry("MS", false)
	// MT for Malta
	MT = registerCountry("MT", false)
	// MU for Mauritius
	MU = registerCountry("MU", false)
	// MV for Maldives (Maldive Islands)
	MV = registerCountry("MV", false)
	// MW for Malawi
	MW = registerCountry("MW", false)
	// MX for Mexico
	MX = registerCountry("MX", false)
	// MZ for Mozambique
	MZ = registerCountry("MZ", false)
	// NA for Namibia
	NA = registerCountry("NA", false)
	// NC for New Caledonia
	NC = registerCountry("NC", false)
	// NE for Niger
	NE = registerCountry("NE", false)
	// NF for Norfolk Island
	NF = registerCountry("NF", false)
	// NG for Nigeria
	NG = registerCountry("NG", false)
	// NI for Nicaragua
	NI = registerCountry("NI", false)
	// NL for Netherlands
	NL = registerCountry("NL", false)
	// NO for Norway
	NO = registerCountry("NO", false)
	// NP for Nepal
	NP = registerCountry("NP", false)
	// NR for Nauru
	NR = registerCountry("NR", false)
	// NU for Niue
	NU = registerCountry("NU", false)
	// NZ for New Zealand
	NZ = registerCountry("NZ", false)
	// OM for Oman
	OM = registerCountry("OM", false)
	// PA for Panama
	PA = registerCountry("PA", false)
	// PE for Peru
	PE = registerCountry("PE", false)
	// PF for French Polynesia
	PF = registerCountry("PF", false)
	// PG for Papua New Guinea
	PG = registerCountry("PG", false)
	// PK for Pakistan
	PK = registerCountry("PK", false)
	// PL for Poland
	PL = registerCountry("PL", false)
	// PM for Saint Pierre And Miquelon
	PM = registerCountry("PM", false)
	// PN for Pitcairn
	PN = registerCountry("PN", false)
	// PR for Puerto Rico
	PR = registerCountry("PR", false)
	// PS for Palestine
	PS = registerCountry("PS", false)
	// PT for Portugal
	PT = registerCountry("PT", false)
	// PW for Palau
	PW = registerCountry("PW", false)
	// PY for Paraguay
	PY = registerCountry("PY", false)
	// QA for Qatar
	QA = registerCountry("QA", false)
	// RE for Reunion
	RE = registerCountry("RE", false)
	// RO for Romania
	RO = registerCountry("RO", false)
	// RS for Serbia
	RS = registerCountry("RS", false)
	// RU for Russia
	RU = registerCountry("RU", false)
	// RW for Rwanda
	RW = registerCountry("RW", false)
	// SA for Saudi Arabia
	SA = registerCountry("SA", false)
	// SB for Solomon Islands
	SB = registerCountry("SB", false)
	// SC for Seychelles
	SC = registerCountry("SC", false)
	// SD for Sudan
	SD = registerCountry("SD", false)
	// SE for Sweden
	SE = registerCountry("SE", false)
	// SH for Saint Helena
	SH = registerCountry("SH", false)
	// SI for Slovenia
	SI = registerCountry("SI", false)
	// SJ for Svalbard And Jan Mayen
	SJ = registerCountry("SJ", false)
	// SK for Slovakia
	SK = registerCountry("SK", false)
	// SL for Sierra Leone
	SL = registerCountry("SL", false)
	// SM for San Marino
	SM = registerCountry("SM", false)
	// SN for Senegal
	SN = registerCountry("SN", false)
	// SO for Somalia
	SO = registerCountry("SO", false)
	// SR for Suriname
	SR = registerCountry("SR", false)
	// SS for South Sudan
	SS = registerCountry("SS", false)
	// ST for São Tome and Principe
	ST = registerCountry("ST", false)
	// SV for El Salvador
	SV = registerCountry("SV", false)
	// SX for Sint Maarten (Dutch Part)
	SX = registerCountry("SX", false)
	// SY for Syria
	SY = registerCountry("SY", false)
	// SZ for Swaziland
	SZ = registerCountry("SZ", false)
	// TC for Turks And Caicos Islands
	TC = registerCountry("TC", false)
	// TD for Chad
	TD = registerCountry("TD", false)
	// TF for French Southern Territories
	TF = registerCountry("TF", false)
	// TG for Togo
	TG = registerCountry("TG", false)
	// TJ for Tajikistan
	TJ = registerCountry("TJ", false)
	// TK for Tokelau
	TK = registerCountry("TK", false)
	// TL for Timor-Leste
	TL = registerCountry("TL", false)
	// TM for Turkmenistan
	TM = registerCountry("TM", false)
	// TN for Tunisia
	TN = registerCountry("TN", false)
	// TO for Tonga
	TO = registerCountry("TO", false)
	// TR for Turkey
	TR = registerCountry("TR", false)
	// TT for Trinidad And Tobago
	TT = registerCountry("TT", false)
	// TV for Tuvalu
	TV = registerCountry("TV", false)
	// TW for Taiwan
	TW = registerCountry("TW", false)
	// TZ for Tanzania
	TZ = registerCountry("TZ", false)
	// UA for Ukraine
	UA = registerCountry("UA", false)
	// UG for Uganda
	UG = registerCountry("UG", false)
	// UM for United States Minor Outlying Islands
	UM = registerCountry("UM", false)
	// UY for Uruguay
	UY = registerCountry("UY", false)
	// UZ for Uzbekistan
	UZ = registerCountry("UZ", false)
	// VA for Vatican
	VA = registerCountry("VA", false)
	// VC for Saint Vincent And The Grenadines
	VC = registerCountry("VC", false)
	// VE for Venezuela
	VE = registerCountry("VE", false)
	// VG for British Virgin Islands
	VG = registerCountry("VG", false)
	// VI for U.S. Virgin Islands
	VI = registerCountry("VI", false)
	// VU for Vanuatu
	VU = registerCountry("VU", false)
	// WF for Wallis And Futuna
	WF = registerCountry("WF", false)
	// WS for Samoa
	WS = registerCountry("WS", false)
	// YE for Yemen
	YE = registerCountry("YE", false)
	// YT for Mayotte
	YT = registerCountry("YT", false)
	// ZA for South Africa
	ZA = registerCountry("ZA", false)
	// ZM for Zambia
	ZM = registerCountry("ZM", false)
	// ZW for Zimbabwe
	ZW = registerCountry("ZW", false)
)

a list of country codes

View Source
var (
	// IDR is the currency for Indonesia.
	IDR = register("IDR", "Rp", ID, "Rp%.f", 360, 2)
	// MYR is the currency for Malaysia.
	MYR = register("MYR", "RM", MY, "RM%.2f", 458, 2)
	// PHP is the currency for Philippines.
	PHP = register("PHP", "₱", PH, "₱%.2f", 608, 2)
	// SGD is the currency for Singapore.
	SGD = register("SGD", "S$", SG, "S$%.2f", 702, 2)
	// THB is the currency for Thailand.
	THB = register("THB", "฿", TH, "฿%.2f", 764, 2)
	// VND is the currency for Vietnam.
	VND = register("VND", "₫", VN, "%.f₫", 704, 0)
	// USD is the currency for UnitedStates.
	USD = register("USD", "US$", US, "$%.2f", 840, 2)
	// MMK is the currency for Myanmar.
	MMK = register("MMK", "K", MM, "K%.2f", 104, 2)
	// KHR is the currency for Cambodia.
	KHR = register("KHR", "៛", KH, "៛%.f", 116, 2)

	// AED ...
	AED = register("AED", "DH", "", "DH%.2f", 784, 2)
	// AFN ...
	AFN = register("AFN", "", "", "%.2f", 971, 2)
	// ALL ...
	ALL = register("ALL", "Lek", "", "Lek%.2f", 8, 2)
	// AMD ...
	AMD = register("AMD", "", "", "%.2f", 51, 2)
	// ANG ...
	ANG = register("ANG", "NAƒ", "", "NAƒ%.2f", 532, 2)
	// AOA ...
	AOA = register("AOA", "Kz", "", "Kz%.2f", 973, 2)
	// ARS ...
	ARS = register("ARS", "$", "", "$%.2f", 32, 2)
	// AUD ...
	AUD = register("AUD", "$", "", "$%.2f", 36, 2)
	// AWG ...
	AWG = register("AWG", "", "", "%.2f", 533, 2)
	// AZN ...
	AZN = register("AZN", "", "", "%.2f", 944, 2)
	// BAM ...
	BAM = register("BAM", "KM", "", "KM%.2f", 977, 2)
	// BBD ...
	BBD = register("BBD", "$", "", "$%.2f", 52, 2)
	// BDT ...
	BDT = register("BDT", "", "", "%.2f", 50, 2)
	// BGN ...
	BGN = register("BGN", "лв.", "", "лв.%.2f", 975, 2)
	// BHD ...
	BHD = register("BHD", "BD", "", "BD%.3f", 48, 3)
	// BIF ...
	BIF = register("BIF", "FBu", "", "FBu%.f", 108, 0)
	// BMD ...
	BMD = register("BMD", "$", "", "$%.2f", 60, 2)
	// BND ...
	BND = register("BND", "B$", "", "B$%.2f", 96, 2)
	// BOB ...
	BOB = register("BOB", "$b", "", "$b%.2f", 68, 2)
	// BOV ...
	BOV = register("BOV", "", "", "%.2f", 984, 2)
	// BRL ...
	BRL = register("BRL", "R$", "", "R$%.2f", 986, 2)
	// BSD ...
	BSD = register("BSD", "$", "", "$%.2f", 44, 2)
	// BTN ...
	BTN = register("BTN", "Nu.", "", "Nu.%.2f", 64, 2)
	// BWP ...
	BWP = register("BWP", "P", "", "P%.2f", 72, 2)
	// BYR ...
	BYR = register("BYR", "p.", "", "p.%.f", 974, 0)
	// BZD ...
	BZD = register("BZD", "BZ$", "", "BZ$%.2f", 84, 2)
	// CAD ...
	CAD = register("CAD", "$", "", "$%.2f", 124, 2)
	// CDF ...
	CDF = register("CDF", "FC", "", "FC%.2f", 976, 2)
	// CHF ...
	CHF = register("CHF", "SFr.", "", "SFr.%.2f", 756, 2)
	// CLF ...
	CLF = register("CLF", "UF", "", "UF%.4f", 990, 4)
	// CLP ...
	CLP = register("CLP", "", "", "%.f", 152, 0)
	// CNH ...
	CNH = register("CNH", "¥", "", "¥%.2f", 157, 2)
	// CNY ...
	CNY = register("CNY", "", "", "%.2f", 156, 2)
	// COP ...
	COP = register("COP", "$", "", "$%.2f", 170, 2)
	// COU ...
	COU = register("COU", "", "", "%.2f", 970, 2)
	// CRC ...
	CRC = register("CRC", "₡", "", "₡%.2f", 188, 2)
	// CUC ...
	CUC = register("CUC", "CUC$", "", "CUC$%.2f", 931, 2)
	// CUP ...
	CUP = register("CUP", "$MN", "", "$MN%.2f", 192, 2)
	// CVE ...
	CVE = register("CVE", "", "", "%.2f", 132, 2)
	// CZK ...
	CZK = register("CZK", "Kč", "", "Kč%.2f", 203, 2)
	// DJF ...
	DJF = register("DJF", "Fdj", "", "Fdj%.f", 262, 0)
	// DKK ...
	DKK = register("DKK", "kr.", "", "kr.%.2f", 208, 2)
	// DOP ...
	DOP = register("DOP", "RD$", "", "RD$%.2f", 214, 2)
	// DZD ...
	DZD = register("DZD", "DA", "", "DA%.2f", 12, 2)
	// EGP ...
	EGP = register("EGP", "E£", "", "E£%.2f", 818, 2)
	// ERN ...
	ERN = register("ERN", "Nfk", "", "Nfk%.2f", 232, 2)
	// EUR ...
	EUR = register("EUR", "€", "", "€%.2f", 978, 2)
	// FJD ...
	FJD = register("FJD", "FJ$", "", "FJ$%.2f", 242, 2)
	// FKP ...
	FKP = register("FKP", "FK£", "", "FK£%.2f", 238, 2)
	// GBP ...
	GBP = register("GBP", "£", "", "£%.2f", 826, 2)
	// GEL ...
	GEL = register("GEL", "", "", "%.2f", 981, 2)
	// GHS ...
	GHS = register("GHS", "₵", "", "₵%.2f", 936, 2)
	// GIP ...
	GIP = register("GIP", "£", "", "£%.2f", 292, 2)
	// GMD ...
	GMD = register("GMD", "D", "", "D%.2f", 270, 2)
	// GNF ...
	GNF = register("GNF", "FG", "", "FG%.f", 324, 0)
	// GTQ ...
	GTQ = register("GTQ", "Q", "", "Q%.2f", 320, 2)
	// GYD ...
	GYD = register("GYD", "GY$", "", "GY$%.2f", 328, 2)
	// HKD ...
	HKD = register("HKD", "HK$", "", "HK$%.2f", 344, 2)
	// HNL ...
	HNL = register("HNL", "L", "", "L%.2f", 340, 2)
	// HRK ...
	HRK = register("HRK", "kn", "", "kn%.2f", 191, 2)
	// HTG ...
	HTG = register("HTG", "G", "", "G%.2f", 332, 2)
	// HUF ...
	HUF = register("HUF", "Ft", "", "Ft%.2f", 348, 2)
	// ILS ...
	ILS = register("ILS", "", "", "%.2f", 376, 2)
	// INR ...
	INR = register("INR", "", "", "%.2f", 356, 2)
	// IQD ...
	IQD = register("IQD", "ID", "", "ID%.3f", 368, 3)
	// IRR ...
	IRR = register("IRR", "Rl.", "", "Rl.%.2f", 364, 2)
	// ISK ...
	ISK = register("ISK", "kr", "", "kr%.f", 352, 0)
	// JMD ...
	JMD = register("JMD", "$", "", "$%.2f", 388, 2)
	// JOD ...
	JOD = register("JOD", "JD", "", "JD%.3f", 400, 3)
	// JPY ...
	JPY = register("JPY", "¥", "", "¥%.f", 392, 0)
	// KES ...
	KES = register("KES", "KSh", "", "KSh%.2f", 404, 2)
	// KGS ...
	KGS = register("KGS", "K.S.", "", "K.S.%.2f", 417, 2)
	// KMF ...
	KMF = register("KMF", "CF", "", "CF%.f", 174, 0)
	// KPW ...
	KPW = register("KPW", "₩", "", "₩%.2f", 408, 2)
	// KRW ...
	KRW = register("KRW", "₩", "", "₩%.f", 410, 0)
	// KWD ...
	KWD = register("KWD", "K.D.", "", "K.D.%.3f", 414, 3)
	// KYD ...
	KYD = register("KYD", "CI$", "", "CI$%.2f", 136, 2)
	// KZT ...
	KZT = register("KZT", "", "", "%.2f", 398, 2)
	// LAK ...
	LAK = register("LAK", "", "", "%.2f", 418, 2)
	// LBP ...
	LBP = register("LBP", "L£", "", "L£%.2f", 422, 2)
	// LKR ...
	LKR = register("LKR", "Rs", "", "Rs%.2f", 144, 2)
	// LRD ...
	LRD = register("LRD", "L$", "", "L$%.2f", 430, 2)
	// LSL ...
	LSL = register("LSL", "L", "", "L%.2f", 426, 2)
	// LYD ...
	LYD = register("LYD", "LD", "", "LD%.3f", 434, 3)
	// MAD ...
	MAD = register("MAD", "Dh", "", "Dh%.2f", 504, 2)
	// MDL ...
	MDL = register("MDL", "MDL", "", "MDL%.2f", 498, 2)
	// MGA ...
	MGA = register("MGA", "Ar", "", "Ar%.2f", 969, 2)
	// MKD ...
	MKD = register("MKD", "ден", "", "ден%.2f", 807, 2)
	// MNT ...
	MNT = register("MNT", "", "", "%.2f", 496, 2)
	// MOP ...
	MOP = register("MOP", "MOP$", "", "MOP$%.2f", 446, 2)
	// MRO ...
	MRO = register("MRO", "UM", "", "UM%.2f", 478, 2)
	// MUR ...
	MUR = register("MUR", "Rs", "", "Rs%.2f", 480, 2)
	// MVR ...
	MVR = register("MVR", "Rf", "", "Rf%.2f", 462, 2)
	// MWK ...
	MWK = register("MWK", "MK", "", "MK%.2f", 454, 2)
	// MXN ...
	MXN = register("MXN", "Mex$", "", "Mex$%.2f", 484, 2)
	// MXV ...
	MXV = register("MXV", "", "", "%.2f", 979, 2)
	// MZN ...
	MZN = register("MZN", "MT", "", "MT%.2f", 943, 2)
	// NAD ...
	NAD = register("NAD", "N$", "", "N$%.2f", 516, 2)
	// NGN ...
	NGN = register("NGN", "", "", "%.2f", 566, 2)
	// NIO ...
	NIO = register("NIO", "C$", "", "C$%.2f", 558, 2)
	// NOK ...
	NOK = register("NOK", "kr", "", "kr%.2f", 578, 2)
	// NPR ...
	NPR = register("NPR", "Rps", "", "Rps%.2f", 524, 2)
	// NZD ...
	NZD = register("NZD", "$", "", "$%.2f", 554, 2)
	// OMR ...
	OMR = register("OMR", "RO", "", "RO%.3f", 512, 3)
	// PAB ...
	PAB = register("PAB", "B/.", "", "B/.%.2f", 590, 2)
	// PEN ...
	PEN = register("PEN", "S/.", "", "S/.%.2f", 604, 2)
	// PGK ...
	PGK = register("PGK", "K", "", "K%.2f", 598, 2)
	// PKR ...
	PKR = register("PKR", "Re.", "", "Re.%.2f", 586, 2)
	// PLN ...
	PLN = register("PLN", "zł", "", "zł%.2f", 985, 2)
	// PYG ...
	PYG = register("PYG", "₲", "", "₲%.f", 600, 0)
	// QAR ...
	QAR = register("QAR", "QR", "", "QR%.2f", 634, 2)
	// RON ...
	RON = register("RON", "RON", "", "RON%.2f", 946, 2)
	// RSD ...
	RSD = register("RSD", "d./д.", "", "d./д.%.2f", 941, 2)
	// RUB ...
	RUB = register("RUB", "", "", "%.2f", 643, 2)
	// RWF ...
	RWF = register("RWF", "FRw", "", "FRw%.f", 646, 0)
	// SAR ...
	SAR = register("SAR", "SR", "", "SR%.2f", 682, 2)
	// SBD ...
	SBD = register("SBD", "SI$", "", "SI$%.2f", 90, 2)
	// SCR ...
	SCR = register("SCR", "SR", "", "SR%.2f", 690, 2)
	// SDG ...
	SDG = register("SDG", "", "", "%.2f", 938, 2)
	// SEK ...
	SEK = register("SEK", "kr", "", "kr%.2f", 752, 2)
	// SHP ...
	SHP = register("SHP", "£", "", "£%.2f", 654, 2)
	// SLL ...
	SLL = register("SLL", "Le", "", "Le%.2f", 694, 2)
	// SOS ...
	SOS = register("SOS", "Sh.So.", "", "Sh.So.%.2f", 706, 2)
	// SRD ...
	SRD = register("SRD", "$", "", "$%.2f", 968, 2)
	// SSP ...
	SSP = register("SSP", "SSP", "", "SSP%.2f", 728, 2)
	// STD ...
	STD = register("STD", "Db", "", "Db%.2f", 678, 2)
	// SVC ...
	SVC = register("SVC", "₡", "", "₡%.2f", 222, 2)
	// SYP ...
	SYP = register("SYP", "£S", "", "£S%.2f", 760, 2)
	// SZL ...
	SZL = register("SZL", "L", "", "L%.2f", 748, 2)
	// TJS ...
	TJS = register("TJS", "", "", "%.2f", 972, 2)
	// TMT ...
	TMT = register("TMT", "T", "", "T%.2f", 934, 2)
	// TND ...
	TND = register("TND", "DT", "", "DT%.3f", 788, 3)
	// TOP ...
	TOP = register("TOP", "T$", "", "T$%.2f", 776, 2)
	// TRY ...
	TRY = register("TRY", "₺", "", "₺%.2f", 949, 2)
	// TTD ...
	TTD = register("TTD", "TT$", "", "TT$%.2f", 780, 2)
	// TWD ...
	TWD = register("TWD", "NT$", "", "NT$%.2f", 901, 2)
	// TZS ...
	TZS = register("TZS", "TSh", "", "TSh%.2f", 834, 2)
	// UAH ...
	UAH = register("UAH", "₴", "", "₴%.2f", 980, 2)
	// UGX ...
	UGX = register("UGX", "USh", "", "USh%.f", 800, 0)
	// UYU ...
	UYU = register("UYU", "$U", "", "$U%.2f", 858, 2)
	// UZS ...
	UZS = register("UZS", "U.S.", "", "U.S.%.2f", 860, 2)
	// VEF ...
	VEF = register("VEF", "Bs.", "", "Bs.%.2f", 937, 2)
	// VUV ...
	VUV = register("VUV", "VT", "", "VT%.f", 548, 0)
	// WST ...
	WST = register("WST", "WS$", "", "WS$%.2f", 882, 2)
	// XAF ...
	XAF = register("XAF", "FCFA", "", "FCFA%.f", 950, 0)
	// XCD ...
	XCD = register("XCD", "$", "", "$%.2f", 951, 2)
	// XOF ...
	XOF = register("XOF", "F", "", "F%.f", 952, 0)
	// XPF ...
	XPF = register("XPF", "F", "", "F%.f", 953, 0)
	// YER ...
	YER = register("YER", "Rl", "", "Rl%.2f", 886, 2)
	// ZAR ...
	ZAR = register("ZAR", "R", "", "R%.2f", 710, 2)
	// ZMW ...
	ZMW = register("ZMW", "K", "", "K%.2f", 967, 2)

	// Point is the currency for Point. Point stores in user's point wallet
	Point = register("GPT", "", "", "%f", 3001, 0)

	// Currencies contains a list of all supported currencies
	Currencies = []Currency{}
)
View Source
var (
	// ErrUnknownCurrency signifies the error when there is an unknown currency
	ErrUnknownCurrency = errors.New("unknown currency. Undefined exponent")
)

Functions

func GenerateHash

func GenerateHash(input string) string

GenerateHash returns a sha256 checksum of the input

func GenerateHmac

func GenerateHmac(input string, method func() hash.Hash) string

func GetErrorName

func GetErrorName(code int) string

GetErrorName returns an error name given an HTTP code.

func GetISO

func GetISO(currency Currency) int16

GetISO will attempt to the appropriate iso value for the supplied currency

func GetSymbol

func GetSymbol(currency Currency) string

GetSymbol will attempt to the appropriate symbol for the supplied currency

func IsInvalid

func IsInvalid(curr Currency) bool

IsInvalid checks the invalidity of currency.

func IsValid

func IsValid(curr Currency) bool

IsValid checks the validity of currency.

func NewError

func NewError(etype string, message string, data interface{}) error

NewError creates and returns a new instace of Error with custom error metadata.

func NewMD5Hash

func NewMD5Hash(key string) string

NewMD5Hash generates a MD5 hash without '-' based on the input key

func NewUUID

func NewUUID() string

NewUUID generates a new UUID version 4 without '-'

func NewUUIDV5

func NewUUIDV5(namespace, name string) string

NewUUIDV5 generates a new UUID version 5 without '-' based on https://tools.ietf.org/html/rfc4122 page18

func RecoverFromPanic

func RecoverFromPanic(ctx context.Context, logger logger.Logger, tags ...string)

Types

type Country

type Country string

Country defines the type for countries.

func (Country) IsGrabOperatingCountry

func (country Country) IsGrabOperatingCountry() bool

IsGrabOperatingCountry returns whether it is a grab operating country.

func (Country) IsValid

func (country Country) IsValid() bool

IsValid checks the validity of country.

func (Country) String

func (country Country) String() string

String implements the Stringer.

type Currency

type Currency string

Currency is a custom type for representing currencies.

const (
	ANY Currency = ""
)

List of Currencies currently supported by the system Format: http://en.wikipedia.org/wiki/ISO_4217

func GetByCode

func GetByCode(code string) Currency

GetByCode will attempt to convert from string to Currency.

func GetByCountry

func GetByCountry(ctx context.Context, country Country) Currency

GetByCountry get currency by country. Deprecated Do not use anymore! Because country <-> currency is not 1-1 mapping. Use GetByGrabOperatingCountry instead. Your API or data input should have currency directly instead of using country to get.

func GetByGrabOperatingCountry

func GetByGrabOperatingCountry(country Country) Currency

GetByGrabOperatingCountry will return the currency for Grab operating country. Because in SEA, country currency 1-1 mapping is true. If a non-Grab-Operating country is passed in, empty currency will be returned.

func GetByISO

func GetByISO(iso int16) Currency

GetByISO will attempt to convert from iso to Currency.

func (Currency) Format

func (curr Currency) Format(amount float64) string

Format formats an amount using appropriate format of this currency. Deprecated: it's not good to pass amount in float.

func (Currency) GetCountry

func (curr Currency) GetCountry(ctx context.Context) Country

GetCountry gets country code from currency default empty. Deprecated Do not use anymore! Your API or data input should have the country directly or have lat/lon to get from borders, currency cannot decide where the country is.

func (Currency) GetFormat

func (curr Currency) GetFormat() string

GetFormat return the format for currency

func (Currency) GetMinorUnitAmount

func (curr Currency) GetMinorUnitAmount(amountInFloat float64) (int64, error)

GetMinorUnitAmount returns the amount presented in minor unit format in int64 format. ref: https://en.wikipedia.org/wiki/ISO_4217

Try to avoid using this method, because it's using a float64 parameter. Ideally, we will always use integers everywhere, this method is only to adaptor legacy code/services. Deprecated: use ToMinorUnit in amount package instead.

func (Currency) GetStandardExponent

func (curr Currency) GetStandardExponent() (int, error)

GetStandardExponent returns the standard exponent of currency, it is for display minor unit amount. the standard is from https://en.wikipedia.org/wiki/ISO_4217

func (*Currency) MarshalJSON

func (curr *Currency) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding.JSON interface

func (Currency) String

func (curr Currency) String() string

String implements the Stringer.

func (*Currency) UnmarshalJSON

func (curr *Currency) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the encoding.JSON interface.

type Error

type Error struct {
	Code      int
	ErrorType string
	Message   string
	Data      interface{}
}

Error is the error type used for all API errors.

func (Error) Error

func (e Error) Error() string

This makes Error a valid Go error type.

type ErrorBase

type ErrorBase struct {
	ElementClone []interface{}
	// contains filtered or unexported fields
}

ErrorBase is the real type of SmartError, which is a wrapper type for saving code to generate.

func ErrorBaseNew

func ErrorBaseNew(info string, elementToClone ...interface{}) (o *ErrorBase)

ErrorBaseNew creates a ErrorBase object

func (*ErrorBase) Error

func (o *ErrorBase) Error() string

Error fulfills the error interface

func (*ErrorBase) Pretty

func (o *ErrorBase) Pretty() (dump string)

Pretty for dumping information captured in the error object

type ErrorCode

type ErrorCode int

type Mapper

type Mapper int16
const (
	JSONMapper Mapper = iota
	YAMLMapper
	TOMLMapper
)

type ObjectMapper

type ObjectMapper interface {
	// Marshal obj to string
	Marshal(interface{}) (string, error)

	// Unmarshal string to obj
	Unmarshal(string, interface{}) error

	// UnmarshalGeneric unmarshal to any generic interface
	UnmarshalGeneric(string) (interface{}, error)
}

ObjectMapper interface for all object mapper

func New

func New(mapperType Mapper) ObjectMapper

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL