gocountries

package module
v0.0.0-...-aaf4e81 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2015 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Gocountry

This is a Go wrapper library around the API provided by Restcountries.

Installation

Just go with

go get github.com/alediaferia/gocountries

Example Usage

package main

import (
    "fmt"
    "github.com/alediaferia/gocountries"
)

func main() {
    countries, err := gocountries.CountriesByName("italy")

    if err == nil {
        country := (countries)[0]
        fmt.Println(fmt.Sprintf("The capital of Italy is %s", country.Capital))
    }
}

Contribution

Please, feel free to contribute to this project.

The following branches are currently active:

  • master: this is the stable branch which reflects the latest release
  • develop: this is where the magic happens :)

Additionally, I'd suggest you to create a hotfix/ branch when contributing to this repo. Anyway, anything you like is fine, just try to be as descriptive as possible when choosing your branch names so that everything remains as readable as possible.

Thank you for your contributions in advance.

License

This library is provided with a MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Country

type Country struct {
	Name           string
	Capital        string
	AltSpellings   []string
	Relevance      string
	Region         string
	Subregion      string
	Translations   map[string]string
	Population     int32
	LatLng         []float32
	Demonym        string
	Area           float32
	Gini           float32
	Timezones      []string
	Borders        []string
	NativeName     string
	CallingCodes   []string
	TopLevelDomain []string
	Alpha2Code     string
	Alpha3Code     string
	Currencies     []string
	Languages      []string
}

func CountriesByCapital

func CountriesByCapital(name string) ([]Country, error)

func CountriesByName

func CountriesByName(name string) ([]Country, error)

Jump to

Keyboard shortcuts

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