[#316] locode/boltdb: Replace all references to the City with Location

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-10 13:20:39 +03:00 committed by Leonard Lyubich
parent 0a87fec6c6
commit 9a425924cf
4 changed files with 27 additions and 27 deletions

View file

@ -48,26 +48,26 @@ func locationBucketKey(lc *locodedb.LocationCode) ([]byte, error) {
}
type recordJSON struct {
CountryName string
CityName string
SubDivName string
SubDivCode string
Latitude float64
Longitude float64
Continent string
CountryName string
LocationName string
SubDivName string
SubDivCode string
Latitude float64
Longitude float64
Continent string
}
func recordValue(r locodedb.Record) ([]byte, error) {
p := r.GeoPoint()
rj := &recordJSON{
CountryName: r.CountryName(),
CityName: r.CityName(),
SubDivName: r.SubDivName(),
SubDivCode: r.SubDivCode(),
Latitude: p.Latitude(),
Longitude: p.Longitude(),
Continent: r.Continent().String(),
CountryName: r.CountryName(),
LocationName: r.LocationName(),
SubDivName: r.SubDivName(),
SubDivCode: r.SubDivCode(),
Latitude: p.Latitude(),
Longitude: p.Longitude(),
Continent: r.Continent().String(),
}
return json.Marshal(rj)
@ -82,7 +82,7 @@ func recordFromValue(data []byte) (*locodedb.Record, error) {
r := new(locodedb.Record)
r.SetCountryName(rj.CountryName)
r.SetCityName(rj.CityName)
r.SetLocationName(rj.LocationName)
r.SetSubDivName(rj.SubDivName)
r.SetSubDivCode(rj.SubDivCode)
r.SetGeoPoint(locodedb.NewPoint(rj.Latitude, rj.Longitude))