country

package
Version: v0.0.0-...-e4f67f1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2014 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package country implements the methods of a stddata.Provider. It provides searches against the data set of ISO 3166-2 country codes. Source data is declared in countrydata.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Country

type Country struct {
	EnglishName string
	Alpha2Code  string
	Alpha3Code  string
	NumericCode string
}

Country models one entity.

type CountryProvider

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

CountryProvider implements the Provider interface.

func (*CountryProvider) Load

func (p *CountryProvider) Load() (n int, err error)

Load implements the Loader interface

func (*CountryProvider) Search

func (p *CountryProvider) Search(index string, query string) (result interface{}, err error)

Search returns a collection as an interface{} and error. The collection contains an array of the results to the search. The value in index is used to choose the map of Country entities that will be searched. If the value in index does not match the name of a map, an error is returned. The keys in the map specified by index are searched using a regex-like 'query.*', and any matching Countries are returned in the result. Search can also "dump" an index. When the value of query is "_dump", the index specified is used to supply the entire data set, in the order of the index.

type CountryResult

type CountryResult struct {
	Countries [][]Country
}

CountryResult is the interface{} that is returned from Search

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