addressor

package
v0.0.0-...-a2a55bd Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GOOGLE_ADDRESS_URL string = "https://chromium-i18n.appspot.com/ssl-address"
	NUM_WORKERS        int    = 25
)

Variables

View Source
var (
	ADDRESS_FORMAT_REGEX = regexp.MustCompile(`%[NOADCSZX]`)
	REMOVE_LANG_REGEX    = regexp.MustCompile(`--.*`)

	POST_PREFIX_FIXES = map[string]string{
		"PR": "PR ",
	}

	LANGUAGE_OVERRIDES = map[string]string{
		"AQ": "en",
		"AS": "en",
		"BQ": "nl",
		"BV": "nb",
		"CW": "nl",
		"DJ": "fr",
		"GS": "en",
		"HM": "en",
		"MV": "en",
		"PG": "en",
		"PW": "en",
		"TK": "en",
		"VU": "fr",
		"WS": "en",
	}

	LOCAL_NAME_OVERRIDES = map[string]string{
		"TV": "Tuvalu",
	}
)

Functions

func DecodeCountries

func DecodeCountries(reader io.Reader) (externalCountries, error)

Types

type Country

type Country struct {
	ID   string
	Name string

	DefaultLanguage string

	PostCodePrefix string
	PostCodeRegex  postCodeRegex

	Format          string
	LatinizedFormat string

	AdministrativeAreaNameType libaddress.FieldName
	LocalityNameType           libaddress.FieldName
	DependentLocalityNameType  libaddress.FieldName
	PostCodeNameType           libaddress.FieldName

	AllowedFields  map[libaddress.Field]struct{}
	RequiredFields map[libaddress.Field]struct{}
	Upper          map[libaddress.Field]struct{}

	AdministrativeAreas map[string]administrativeAreaSlice
}

func (Country) ToCode

func (c Country) ToCode() string

type Result

type Result struct {
	Error   error
	Country Country
}

type Worker

type Worker struct {
	CC   chan string
	Stop chan struct{}
	Res  chan Result
}

func (*Worker) Start

func (w *Worker) Start()

Jump to

Keyboard shortcuts

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