Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeoNames ¶ added in v0.26.1
type GeoNames struct {
GeoNameID int `gorm:"column:geoname_id"`
LocaleCode string `gorm:"column:locale_code"`
ContinentCode string `gorm:"column:continent_code"`
ContinentName string `gorm:"column:continent_name"`
CountryIsoCode string `gorm:"column:country_iso_code"`
CountryName string `gorm:"column:country_name"`
Subdivision1IsoCode string `gorm:"column:subdivision_1_iso_code"`
Subdivision1Name string `gorm:"column:subdivision_1_name"`
Subdivision2IsoCode string `gorm:"column:subdivision_2_iso_code"`
Subdivision2Name string `gorm:"column:subdivision_2_name"`
CityName string `gorm:"column:city_name"`
MetroCode string `gorm:"column:metro_code"`
TimeZone string `gorm:"column:time_zone"`
IsInEuropeanUnion string `gorm:"column:is_in_european_union"`
}
type Geolocation ¶
type Geolocation interface {
Lookup(ip net.IP) (*Record, error)
GetAllCountries() ([]Country, error)
GetCitiesByCountry(countryISOCode string) ([]City, error)
Stop() error
}
func NewGeolocation ¶
type Mock ¶ added in v0.36.0
type Mock struct{}
func (*Mock) GetAllCountries ¶ added in v0.36.0
func (*Mock) GetCitiesByCountry ¶ added in v0.36.0
type Record ¶
type Record struct {
City struct {
GeonameID uint `maxminddb:"geoname_id"`
Names struct {
En string `maxminddb:"en"`
} `maxminddb:"names"`
} `maxminddb:"city"`
Continent struct {
GeonameID uint `maxminddb:"geoname_id"`
Code string `maxminddb:"code"`
} `maxminddb:"continent"`
Country struct {
GeonameID uint `maxminddb:"geoname_id"`
ISOCode string `maxminddb:"iso_code"`
} `maxminddb:"country"`
}
type SqliteStore ¶
type SqliteStore struct {
// contains filtered or unexported fields
}
SqliteStore represents a location storage backed by a Sqlite DB.
func NewSqliteStore ¶
func (*SqliteStore) GetAllCountries ¶
func (s *SqliteStore) GetAllCountries() ([]Country, error)
GetAllCountries returns a list of all countries in the store.
func (*SqliteStore) GetCitiesByCountry ¶
func (s *SqliteStore) GetCitiesByCountry(countryISOCode string) ([]City, error)
GetCitiesByCountry retrieves a list of cities from the store based on the given country ISO code.
Click to show internal directories.
Click to hide internal directories.