country

package module
Version: v0.0.0-...-fa1977b Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: MIT Imports: 4 Imported by: 0

README

Country

Project status Build Status cover.run go Go Report Card GoDoc License

Country is the package that helps you to get country name and dialing code by the country ISO 3166-1 Alpha-2 code.

Installation Process

 go get github.com/IftekherSunny/go_country

Basic Uses

Get all countries name and dialing code
country := country.NewCountry()

countries := country.All()
Get a country name and dialing code
country := country.NewCountry()

countryDetails, _ := country.Get("BD")
Get multiple countries name and dialing code
country := country.NewCountry()

countries, _ := country.Get([]string{"BD", "US"})
Get a country name
country := country.NewCountry()

name, _ := country.GetName("BD")
Get a country dialing code
country := country.NewCountry()

dialingCode, _ := country.GetDialingCode("BD")

Test

Run tests
go test -v

License

This package is licensed under the MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValidationError

func NewValidationError(code string) error

NewValidationError will create a new validation error class

Types

type Country

type Country struct {
	// contains filtered or unexported fields
}

Country struct

func NewCountry

func NewCountry() *Country

NewCountry will create a new instance of country struct

func (*Country) All

func (country *Country) All() map[string]interface{}

All will return all countries name and dialing code

func (*Country) Get

func (country *Country) Get(code interface{}) (interface{}, error)

Get a country name and dialing code by the country ISO 3166-1 Alpha-2 code

func (*Country) GetDialingCode

func (country *Country) GetDialingCode(code string) (interface{}, error)

GetDialingCode will return a country dialing code by the country ISO 3166-1 Alpha-2 code

func (*Country) GetName

func (country *Country) GetName(code string) (interface{}, error)

GetName will return a country name by the country ISO 3166-1 Alpha-2 code

type ValidationError

type ValidationError struct {
	// contains filtered or unexported fields
}

ValidationError struct

func (ValidationError) Error

func (v ValidationError) Error() string

implementing error method

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL