Documentation
¶
Overview ¶
Package location is a togo plugin: a localization dataset — countries (ISO 3166-1 + currency + dial code + a representative timezone), languages (ISO 639-1), and IANA timezones — with lookup helpers and a REST API. An optional cities/areas dataset can be loaded at runtime via LoadCities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadCities ¶
LoadCities registers a cities dataset (country code → cities). Call from an app or a richer location-data plugin to extend the built-in dataset.
Types ¶
type City ¶
type City struct {
Name string `json:"name"`
Country string `json:"country"`
Region string `json:"region"`
Lat float64 `json:"lat"`
Lng float64 `json:"lng"`
}
City is a place inside a country (loaded via LoadCities).
func CitiesByCountry ¶
CitiesByCountry returns cities for a country code (empty unless LoadCities ran).
type Country ¶
type Country struct {
Code string `json:"code"` // ISO 3166-1 alpha-2
Name string `json:"name"`
Currency string `json:"currency"` // ISO 4217
Dial string `json:"dial"` // E.164 calling code
Region string `json:"region"`
Timezone string `json:"timezone"` // representative IANA zone
}
Country is an ISO 3166-1 country with currency, calling code and a default tz.
func CountryByCode ¶
Country looks up a country by ISO 3166-1 alpha-2 code (case-insensitive).