Documentation
¶
Index ¶
Constants ¶
View Source
const (
GeoSqliteDBFile = "geonames.db"
)
View Source
const MMDBFileName = "GeoLite2-City.mmdb"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Geolocation ¶
type Geolocation struct {
// contains filtered or unexported fields
}
func NewGeolocation ¶
func NewGeolocation(datadir string) (*Geolocation, error)
func (*Geolocation) GetAllCountries ¶
func (gl *Geolocation) GetAllCountries() ([]Country, error)
GetAllCountries retrieves a list of all countries.
func (*Geolocation) GetCitiesByCountry ¶
func (gl *Geolocation) GetCitiesByCountry(countryISOCode string) ([]City, error)
GetCitiesByCountry retrieves a list of cities in a specific country based on the country's ISO code.
func (*Geolocation) Stop ¶
func (gl *Geolocation) Stop() error
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 NewSqliteStore(dataDir string) (*SqliteStore, error)
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.