hajnalandor / iso3166

3 stars 3 forks source link

Normalize the data structure #5

Closed PumpkinSeed closed 3 years ago

PumpkinSeed commented 3 years ago

Normalize data structure based on the following rules.

countries.go: the merge of the ....-alpha2.go and ....-alpha3.go


subdivisions.go:

type Country struct {
    Alpha2           string
    Alpha3           string
    Name             string
    OfficialName     string
    CommonName       string
    Numeric          string
    Subdivsions [N]Subdivsion
}

type Subdivsion struct {
    Name             string
    Type             string
    LocalName        string
    LanguageCode     string
    ParentCode      string
}

var Countries = [O]Country {
...
}

where


functions.go

ParseCountry(string) Country, error
ParseSubdivision(string) Subdivision, error