Documentation ¶
Index ¶
- Constants
- Variables
- func GeoNameContinents() []*entity.GeoNameContinent
- type Continent
- type CustomGeonamesEntity
- type CustomGeonamesRecord
- type CustomStorage
- func (s *CustomStorage) Cities(_ context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)
- func (s *CustomStorage) Continents(_ context.Context) []*entity.GeoNameContinent
- func (s *CustomStorage) Countries(_ context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)
- func (s *CustomStorage) Subdivisions(_ context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)
- type GeoNameStorage
- func (r *GeoNameStorage) Cities(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)
- func (r *GeoNameStorage) Continents(ctx context.Context) []*entity.GeoNameContinent
- func (r *GeoNameStorage) Countries(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)
- func (r *GeoNameStorage) Subdivisions(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)
- func (r *GeoNameStorage) WaitReady()
- type MultiStorage
- func (s *MultiStorage) Add(storages ...Storage) *MultiStorage
- func (s *MultiStorage) Cities(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)
- func (s *MultiStorage) Continents(ctx context.Context) []*entity.GeoNameContinent
- func (s *MultiStorage) Countries(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)
- func (s *MultiStorage) Subdivisions(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)
- type Storage
Constants ¶
View Source
const ( AF = 6255146 AS = 6255147 EU = 6255148 NA = 6255149 OC = 6255151 SA = 6255150 AN = 6255152 )
Variables ¶
View Source
var ( ErrGeoNameNotReady = fmt.Errorf("geoname csv dump is %w", utils.ErrNotReady) ErrGeoNameDisabled = fmt.Errorf("geoname csv dump is %w", utils.ErrDisabled) )
Functions ¶
func GeoNameContinents ¶
func GeoNameContinents() []*entity.GeoNameContinent
Types ¶
type CustomGeonamesEntity ¶
type CustomGeonamesRecord ¶
type CustomGeonamesRecord struct { City CustomGeonamesEntity `json:"city"` Subdivision CustomGeonamesEntity `json:"subdivision"` Country CustomGeonamesEntity `json:"country"` Continent CustomGeonamesEntity `json:"continent"` }
func NewCustomGeonamesRecord ¶
func NewCustomGeonamesRecord(geoName string, geoNameID int) CustomGeonamesRecord
func (CustomGeonamesRecord) CityEntity ¶
func (rec CustomGeonamesRecord) CityEntity() *entity.GeoName
func (CustomGeonamesRecord) ContinentEntity ¶
func (rec CustomGeonamesRecord) ContinentEntity() *entity.GeoNameContinent
func (CustomGeonamesRecord) CountryEntity ¶
func (rec CustomGeonamesRecord) CountryEntity() *entity.GeoNameCountry
func (CustomGeonamesRecord) SubdivisionEntity ¶
func (rec CustomGeonamesRecord) SubdivisionEntity() *entity.GeoNameAdminSubdivision
type CustomStorage ¶
type CustomStorage struct {
// contains filtered or unexported fields
}
func NewCustomStorage ¶
func NewCustomStorage(records []CustomGeonamesRecord) *CustomStorage
func NewCustomStorageFromFile ¶
func NewCustomStorageFromFile(path string) (*CustomStorage, error)
func (*CustomStorage) Cities ¶
func (s *CustomStorage) Cities(_ context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)
func (*CustomStorage) Continents ¶
func (s *CustomStorage) Continents(_ context.Context) []*entity.GeoNameContinent
func (*CustomStorage) Countries ¶
func (s *CustomStorage) Countries(_ context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)
func (*CustomStorage) Subdivisions ¶
func (s *CustomStorage) Subdivisions(_ context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)
type GeoNameStorage ¶
type GeoNameStorage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
func NewStorage(dir string) *GeoNameStorage
func (*GeoNameStorage) Cities ¶
func (r *GeoNameStorage) Cities(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)
func (*GeoNameStorage) Continents ¶
func (r *GeoNameStorage) Continents(ctx context.Context) []*entity.GeoNameContinent
func (*GeoNameStorage) Countries ¶
func (r *GeoNameStorage) Countries(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)
func (*GeoNameStorage) Subdivisions ¶
func (r *GeoNameStorage) Subdivisions(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)
func (*GeoNameStorage) WaitReady ¶
func (r *GeoNameStorage) WaitReady()
type MultiStorage ¶
type MultiStorage struct {
// contains filtered or unexported fields
}
func NewMultiStorage ¶
func NewMultiStorage(storages ...Storage) *MultiStorage
func (*MultiStorage) Add ¶
func (s *MultiStorage) Add(storages ...Storage) *MultiStorage
func (*MultiStorage) Cities ¶
func (s *MultiStorage) Cities(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)
func (*MultiStorage) Continents ¶
func (s *MultiStorage) Continents(ctx context.Context) []*entity.GeoNameContinent
func (*MultiStorage) Countries ¶
func (s *MultiStorage) Countries(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)
func (*MultiStorage) Subdivisions ¶
func (s *MultiStorage) Subdivisions(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)
type Storage ¶
type Storage interface { Continents(ctx context.Context) []*entity.GeoNameContinent Countries(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error) Subdivisions(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error) Cities(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error) }
Click to show internal directories.
Click to hide internal directories.