Skip to content
/ gowhere Public

Country names, codes(iso2), phone extentions, currency and currency symbols

License

Notifications You must be signed in to change notification settings

ae0000/gowhere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gowhere

Go Report Card Build Status cover.run GoDoc License

Gowhere provides an easy way to get country data. See below for usage. Each country consists of the following struct:

Country{
    Code:           "AU", // iso2 code
    Currency:       "AUD",
    CurrencySymbol: "$",
    Phone:          "+61",
    Name:           "Australia",
},

Install

go get -u github.com/ae0000/gowhere

Usage

Get a list of countries (to iterate over, etc.)

for _, c := range gowhere.Countries {
    fmt.Println(c.Name, c.Code, c.Currency)
}

Get a countries phone, name, currency symbol or currency

countryCode := "AU"
fmt.Printf("In %s where the phone ext is %s, the price is: %s10.00 (%s)",
    gowhere.Name(countryCode),
    gowhere.Phone(countryCode),
    gowhere.CurrencySymbol(countryCode),
    gowhere.Currency(countryCode))

// In Australia where the phone ext is +61, the price is: $10.00 (AUD)

Get a country

c := gowhere.GetCountry(users.CountryCode)
fmt.Println(c.Name)
fmt.Println(c.Phone)
fmt.Println(c.Currency)

Get a list of names

names := gowhere.CountryNames()
for _, c := range names{
    fmt.Println(c)
}

Get a list of codes

codes := gowhere.CountryCodes()
for _, c := range codes{
    fmt.Println(c)
}

About

Country names, codes(iso2), phone extentions, currency and currency symbols

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages