geoCodes

package
v0.0.0-...-bf7031d Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConverterMapXml = map[string]func(interface{}) interface{}{
	"country": func(data interface{}) interface{} {
		country := data.(*Country)
		return CountryToXML(*country)
	},
	"currency": func(data interface{}) interface{} {
		currency := data.(*Currency)
		return CurrencyToXML(*currency)
	},
	"geoSet": func(data interface{}) interface{} {
		geoSet := data.(*GeoSet)
		return GeoSetToXML(*geoSet)
	},
}
View Source
var CountrySettings = SettingsType{
	PrimaryKey: "Alpha2",
	Indexes: []string{
		"Name",
		"FullName",
		"Alpha2",
		"Alpha3",
		"UnM49",
	},
	Public: []string{
		"Name",
		"FullName",
		"OfficialName",
		"Alpha2",
		"Alpha3",
		"UnM49",
		"Flags",
		"Flags.Emoji",
		"Flags.Svg",
		"Dependency",
		"Mottos",
		"Mottos.Official",
		"Mottos.Popular",
		"Mottos.Royal",
		"Mottos.Presidential",
		"Currencies",
		"Currencies.LegalTenders",
		"Currencies.WidelyAccepted",
		"DialCodes",
		"DialCodes.Main",
		"DialCodes.Exceptions",
		"CcTld",
		"CcIdn",
		"TimeZones",
		"Languages",
		"LocalesIcu",
		"OtherAppsIds",
		"OtherAppsIds.GeoNamesOrg",
	},
}
View Source
var CurrencySettings = SettingsType{
	PrimaryKey: "IsoAlpha",
	Indexes: []string{
		"Name",
		"IsoAlpha",
		"IsoNumber",
	},
	Public: []string{
		"Name",
		"IsoAlpha",
		"IsoNumber",
		"Symbol",
		"Decimal",
	},
}
View Source
var GeoSetSettings = SettingsType{
	PrimaryKey: "InternalCode",
	Indexes: []string{
		"Name",
		"InternalCode",
	},
	Public: []string{
		"Name",
		"InternalCode",
		"UnM49",
		"Tags",
		"CountryCodes",
	},
}
View Source
var MapBuildXmlCountries = map[string]XmlFieldMapping{
	"country": {
		TagName:  "country",
		Children: MapBuildXmlCountry,
	},
}
View Source
var MapBuildXmlCountry = map[string]XmlFieldMapping{
	"alpha2": {
		TagName: "alpha2",
	},
	"alpha3": {
		TagName: "alpha3",
	},
	"unM49": {
		TagName: "unM49",
	},
	"name": {
		TagName: "name",
	},
	"fullName": {
		TagName: "fullName",
	},
	"officialName": {
		TagName:      "officialName",
		AsAttributes: true,
		Children: map[string]XmlFieldMapping{
			"name": {
				TagName:  "name",
				AttrName: "lang",
			},
		},
	},
	"flags": {
		TagName: "flags",
		Children: map[string]XmlFieldMapping{
			"emoji": {
				TagName: "emoji",
			},
			"svg": {
				TagName: "svg",
				CDATA:   true,
			},
		},
	},
	"dependency": {
		TagName: "dependency",
	},
	"mottos": {
		TagName: "mottos",
		Children: map[string]XmlFieldMapping{
			"official": {
				TagName: "official",
				Children: map[string]XmlFieldMapping{
					"motto": {
						TagName:  "motto",
						AttrName: "lang",
					},
				},
			},
			"popular": {
				TagName: "popular",
				Children: map[string]XmlFieldMapping{
					"motto": {
						TagName:  "motto",
						AttrName: "lang",
					},
				},
			},
			"royal": {
				TagName: "royal",
				Children: map[string]XmlFieldMapping{
					"motto": {
						TagName:  "motto",
						AttrName: "lang",
					},
				},
			},
			"presidential": {
				TagName: "presidential",
				Children: map[string]XmlFieldMapping{
					"motto": {
						TagName:  "motto",
						AttrName: "lang",
					},
				},
			},
		},
	},
	"currencies": {
		TagName: "currencies",
		Children: map[string]XmlFieldMapping{
			"legalTenders": {
				TagName: "legalTenders",
				Children: map[string]XmlFieldMapping{
					"currency": {
						TagName: "currency",
						Children: map[string]XmlFieldMapping{
							"isoAlpha": {
								TagName: "isoAlpha",
							},
							"isoNumber": {
								TagName: "isoNumber",
							},
							"name": {
								TagName: "name",
							},
							"symbol": {
								TagName: "symbol",
							},
							"decimal": {
								TagName: "decimal",
							},
						},
					},
				},
			},
			"widelyAccepted": {
				TagName: "widelyAccepted",
				Children: map[string]XmlFieldMapping{
					"currency": {
						TagName: "currency",
						Children: map[string]XmlFieldMapping{
							"isoAlpha": {
								TagName: "isoAlpha",
							},
							"isoNumber": {
								TagName: "isoNumber",
							},
							"name": {
								TagName: "name",
							},
							"symbol": {
								TagName: "symbol",
							},
							"decimal": {
								TagName: "decimal",
							},
						},
					},
				},
			},
		},
	},
	"dialCodes": {
		TagName: "dialCodes",
		Children: map[string]XmlFieldMapping{
			"main": {
				TagName: "main",
				Children: map[string]XmlFieldMapping{
					"dial": {
						TagName: "dial",
					},
				},
			},
			"exceptions": {
				TagName: "exceptions",
				Children: map[string]XmlFieldMapping{
					"dial": {
						TagName: "dial",
					},
				},
			},
		},
	},
	"ccTld": {
		TagName: "ccTld",
	},
	"ccIdn": {
		TagName: "ccIdn",
		Children: map[string]XmlFieldMapping{
			"": {
				TagName: "idn",
				Children: map[string]XmlFieldMapping{
					"unicode": {
						TagName: "unicode",
					},
					"punycode": {
						TagName: "punycode",
					},
					"language": {
						TagName: "language",
					},
					"regionsOfUse": {
						TagName: "regionsOfUse",
						Children: map[string]XmlFieldMapping{
							"region": {
								TagName: "region",
							},
						},
					},
				},
			},
		},
	},
	"timeZones": {
		TagName: "timeZones",
		Children: map[string]XmlFieldMapping{
			"tz": {
				TagName: "tz",
			},
		},
	},
	"localesIcu": {
		TagName: "localesIcu",
		Children: map[string]XmlFieldMapping{
			"locale": {
				TagName: "locale",
			},
		},
	},
	"demonyms": {
		TagName: "demonyms",
		Children: map[string]XmlFieldMapping{
			"demonym": {
				TagName: "demonym",
			},
		},
	},
	"otherAppsIds": {
		TagName: "otherAppsIds",
		Children: map[string]XmlFieldMapping{
			"geoNamesOrg": {
				TagName: "geoNamesOrg",
				AsInt:   true,
			},
		},
	},
}
View Source
var MapBuildXmlCurrencies = map[string]XmlFieldMapping{
	"currency": {
		TagName:  "currency",
		Children: MapBuildXmlCurrency,
	},
}
View Source
var MapBuildXmlCurrency = map[string]XmlFieldMapping{
	"isoAlpha": {
		TagName: "isoAlpha",
	},
	"isoNumber": {
		TagName: "isoNumber",
	},
	"name": {
		TagName: "name",
	},
	"symbol": {
		TagName: "symbol",
	},
	"decimal": {
		TagName: "decimal",
		AsInt:   true,
	},
}
View Source
var MapBuildXmlGeoSet = map[string]XmlFieldMapping{
	"internalCode": {
		TagName: "internalCode",
	},
	"unM49": {
		TagName: "unM49",
	},
	"name": {
		TagName: "name",
	},
	"tags": {
		TagName: "tags",
		Children: map[string]XmlFieldMapping{
			"tag": {
				TagName: "tag",
			},
		},
	},
	"countryCodes": {
		TagName: "countryCodes",
		Children: map[string]XmlFieldMapping{
			"cc": {
				TagName: "cc",
			},
		},
	},
}
View Source
var MapBuildXmlGeoSets = map[string]XmlFieldMapping{
	"geoSet": {
		TagName:  "geoSet",
		Children: MapBuildXmlGeoSet,
	},
}
View Source
var SettingsMap = map[string]interface{}{
	"countries":  CountrySettings,
	"geoSets":    GeoSetSettings,
	"currencies": CurrencySettings,
}
View Source
var SingleItemName = map[string]string{
	"countries":  "country",
	"geoSets":    "geoSet",
	"currencies": "currency",
}
View Source
var TransSettingsMap = map[string]interface{}{
	"countries":  TransCountry{},
	"geoSets":    TransGenericItem{},
	"currencies": TransGenericItem{},
}
View Source
var TypeMap = map[string]func() interface{}{
	"countries":  func() interface{} { return &Countries{} },
	"country":    func() interface{} { return &Country{} },
	"currencies": func() interface{} { return &Currencies{} },
	"currency":   func() interface{} { return &Currency{} },
	"geoSets":    func() interface{} { return &GeoSets{} },
	"geoSet":     func() interface{} { return &GeoSet{} },
}
View Source
var TypeMapBuildXml = map[string]map[string]XmlFieldMapping{
	"countries":  MapBuildXmlCountries,
	"country":    MapBuildXmlCountry,
	"geoSets":    MapBuildXmlGeoSets,
	"geoSet":     MapBuildXmlGeoSet,
	"currencies": MapBuildXmlCurrencies,
	"currency":   MapBuildXmlCurrency,
}
View Source
var TypeMapXml = map[string]func() interface{}{
	"countries":  func() interface{} { return &CountriesXml{} },
	"currencies": func() interface{} { return &CurrenciesXml{} },
	"geoSets":    func() interface{} { return &GeoSetsXml{} },
}

Functions

This section is empty.

Types

type CDATA

type CDATA struct {
	Value string `xml:",cdata"`
}

type CcCurrencies

type CcCurrencies struct {
	LegalTenders   []string `json:"legalTenders" yaml:"legalTenders" xml:"legalTenders>currency"`
	WidelyAccepted []string `json:"widelyAccepted" yaml:"widelyAccepted" xml:"widelyAccepted>currency"`
}

type CcIdn

type CcIdn struct {
	Unicode      string   `json:"unicode" yaml:"unicode" xml:"unicode"`
	Punycode     string   `json:"punycode" yaml:"punycode" xml:"punycode"`
	Language     string   `json:"language" yaml:"language" xml:"language"`
	RegionsOfUse []string `json:"regionsOfUse" yaml:"regionsOfUse" xml:"regionsOfUse>region"`
}

type Config

type Config struct {
	Settings Settings `json:"settings"`
}

type ConfigLanguages

type ConfigLanguages struct {
	InPackage []string `json:"inPackage"`
	Default   string   `json:"default"`
}

type Countries

type Countries []Country

type CountriesXml

type CountriesXml struct {
	XMLName   xml.Name     `xml:"countries"`
	Countries []CountryXml `xml:"country"`
}

type Country

type Country struct {
	Name         string            `json:"name" yaml:"name" xml:"name"`
	FullName     string            `json:"fullName" yaml:"fullName" xml:"fullName"`
	OfficialName map[string]string `json:"officialName" yaml:"officialName" xml:"officialName>name"`
	Alpha2       string            `json:"alpha2" yaml:"alpha2" xml:"alpha2"`
	Alpha3       string            `json:"alpha3" yaml:"alpha3" xml:"alpha3"`
	UnM49        string            `json:"unM49" yaml:"unM49" xml:"unM49"`
	Flags        Flags             `json:"flags" yaml:"flags" xml:"flags"`
	Dependency   *string           `json:"dependency" yaml:"dependency" xml:"dependency"`
	Mottos       Mottos            `json:"mottos" yaml:"mottos" xml:"mottos"`
	Currencies   CcCurrencies      `json:"currencies" yaml:"currencies" xml:"currencies"`
	DialCodes    DialCodes         `json:"dialCodes" yaml:"dialCodes" xml:"dialCodes"`
	CcTld        *string           `json:"ccTld" yaml:"ccTld" xml:"ccTld"`
	CcIdn        []CcIdn           `json:"ccIdn" yaml:"ccIdn" xml:"ccIdn>idn"`
	TimeZones    []string          `json:"timeZones" yaml:"timeZones" xml:"timeZones>tz"`
	Languages    []string          `json:"languages" yaml:"languages" xml:"languages>lang"`
	LocalesIcu   []string          `json:"localesIcu" yaml:"localesIcu" xml:"localesIcu>locale"`
	OtherAppsIds OtherAppsIds      `json:"otherAppsIds" yaml:"otherAppsIds" xml:"otherAppsIds"`
	Keywords     []string          `json:"keywords" yaml:"keywords" xml:"keywords"`
}

type CountryXml

type CountryXml struct {
	XMLName xml.Name `xml:"country"`
	Index   string   `xml:"index,attr,omitempty"`
	Country
	Dependency   string          `xml:"dependency"`
	CcTld        string          `xml:"ccTld"`
	OfficialName []LangStructXml `xml:"officialName>name"`
	Mottos       MottosXml       `xml:"mottos"`
	Flags        FlagsXml        `xml:"flags"`
}

func CountryToXML

func CountryToXML(country Country) CountryXml

type Currencies

type Currencies []Currency

type CurrenciesXml

type CurrenciesXml struct {
	XMLName    xml.Name      `xml:"currencies"`
	Currencies []CurrencyXml `xml:"currency"`
}

type Currency

type Currency struct {
	Name      string  `json:"name" yaml:"name" xml:"name"`
	IsoAlpha  string  `json:"isoAlpha" yaml:"isoAlpha" xml:"isoAlpha"`
	IsoNumber string  `json:"isoNumber" yaml:"isoNumber" xml:"isoNumber"`
	Symbol    *string `json:"symbol" yaml:"symbol" xml:"symbol,omitempty"`
	Decimal   *int64  `json:"decimal" yaml:"decimal" xml:"decimal,omitempty"`
}

type CurrencyXml

type CurrencyXml struct {
	XMLName xml.Name `xml:"currency"`
	Index   string   `xml:"index,attr,omitempty"`
	Currency
}

func CurrencyToXML

func CurrencyToXML(currency Currency) CurrencyXml

type DialCodes

type DialCodes struct {
	Main       []string `json:"main" yaml:"main" xml:"main>code"`
	Exceptions []string `json:"exceptions" yaml:"exceptions" xml:"exceptions>code"`
}

type Enquiries

type Enquiries struct {
	Index    *string
	Select   []string
	OrderBy  OrderByStruct
	Interval IntervalStruct
}

type Flags

type Flags struct {
	Emoji string `json:"emoji" yaml:"emoji" xml:"emoji"`
	Svg   string `json:"svg" yaml:"svg" xml:"svg"`
}

type FlagsXml

type FlagsXml struct {
	Svg CDATA `xml:"svg"`
}

type GeoCode

type GeoCode struct {
	SetType      string
	SetLocale    string
	SetObject    map[string]interface{}
	SetEnquiries Enquiries
}

type GeoCodeReference

type GeoCodeReference string

type GeoCodeResult

type GeoCodeResult interface{}

type GeoSet

type GeoSet struct {
	Name         string   `json:"name" yaml:"name" xml:"name"`
	InternalCode string   `json:"internalCode" yaml:"internalCode" xml:"internalCode"`
	UnM49        *string  `json:"unM49" yaml:"unM49" xml:"unM49"`
	Tags         []string `json:"tags" yaml:"tags" xml:"tags>tag"`
	CountryCodes []string `json:"countryCodes" yaml:"countryCodes" xml:"countryCodes>cc"`
}

type GeoSetXml

type GeoSetXml struct {
	XMLName xml.Name `xml:"geoSet"`
	Index   string   `xml:"index,attr,omitempty"`
	GeoSet
}

func GeoSetToXML

func GeoSetToXML(geoSet GeoSet) GeoSetXml

type GeoSets

type GeoSets []GeoSet

type GeoSetsXml

type GeoSetsXml struct {
	XMLName xml.Name    `xml:"geoSets"`
	GeoSets []GeoSetXml `xml:"geoSet"`
}

****

type IntervalStruct

type IntervalStruct struct {
	Offset int
	Limit  int
}

type LangStructXml

type LangStructXml struct {
	Lang  string `xml:"lang,attr"`
	Value string `xml:",chardata"`
}

type Mottos

type Mottos struct {
	Official     map[string]string `json:"official" yaml:"official" xml:"official"`
	Popular      map[string]string `json:"popular" yaml:"popular" xml:"popular"`
	Royal        map[string]string `json:"royal" yaml:"royal" xml:"royal"`
	Presidential map[string]string `json:"presidential" yaml:"presidential" xml:"presidential"`
}

type MottosXml

type MottosXml struct {
	Official []LangStructXml `xml:"official>motto"`
}

type OrderByStruct

type OrderByStruct struct {
	Property  string
	OrderType string
}

type OtherAppsIds

type OtherAppsIds struct {
	GeoNamesOrg *int64 `json:"geoNamesOrg" yaml:"geoNamesOrg" xml:"geoNamesOrg"`
}

type Settings

type Settings struct {
	Languages ConfigLanguages `json:"languages"`
}

type SettingsType

type SettingsType struct {
	PrimaryKey string
	Indexes    []string
	Public     []string
}

type TransCountries

type TransCountries map[string]TransCountry

type TransCountry

type TransCountry struct {
	Keywords []string `json:"keywords"`
	Name     string   `json:"name"`
	FullName string   `json:"fullName"`
	Demonyms []string `json:"demonyms"`
}

type TransGeneric

type TransGeneric map[string]TransGenericItem

type TransGenericItem

type TransGenericItem struct {
	Name string `json:"name"`
}

type XmlFieldMapping

type XmlFieldMapping struct {
	Field        string
	IsList       bool
	CDATA        bool
	AsAttributes bool
	AsInt        bool
	AttrName     string
	TagName      string
	Children     map[string]XmlFieldMapping
}

Jump to

Keyboard shortcuts

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