2019-12-11 16:55:18 +01:00
|
|
|
package entity
|
2018-09-16 19:09:40 +02:00
|
|
|
|
2019-12-20 20:23:16 +01:00
|
|
|
import (
|
|
|
|
"strings"
|
2020-12-13 15:43:01 +01:00
|
|
|
"sync"
|
2019-12-20 20:23:16 +01:00
|
|
|
"time"
|
|
|
|
|
2020-05-26 12:46:22 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/event"
|
2019-12-20 20:23:16 +01:00
|
|
|
"github.com/photoprism/photoprism/internal/maps"
|
2020-01-12 14:00:56 +01:00
|
|
|
"github.com/photoprism/photoprism/pkg/s2"
|
|
|
|
"github.com/photoprism/photoprism/pkg/txt"
|
2019-12-20 20:23:16 +01:00
|
|
|
)
|
2019-12-16 20:22:46 +01:00
|
|
|
|
2020-12-13 15:43:01 +01:00
|
|
|
var cellMutex = sync.Mutex{}
|
|
|
|
|
2021-11-20 16:36:34 +01:00
|
|
|
// Cell represents an S2 cell with metadata and reference to a place.
|
2020-07-12 08:27:05 +02:00
|
|
|
type Cell struct {
|
2020-09-13 17:51:43 +02:00
|
|
|
ID string `gorm:"type:VARBINARY(42);primary_key;auto_increment:false;" json:"ID" yaml:"ID"`
|
2021-11-12 05:09:17 +01:00
|
|
|
CellName string `gorm:"type:VARCHAR(200);" json:"Name" yaml:"Name,omitempty"`
|
2021-11-18 00:46:34 +01:00
|
|
|
CellStreet string `gorm:"type:VARCHAR(100);" json:"Street" yaml:"Street,omitempty"`
|
|
|
|
CellPostcode string `gorm:"type:VARCHAR(50);" json:"Postcode" yaml:"Postcode,omitempty"`
|
2021-11-12 05:09:17 +01:00
|
|
|
CellCategory string `gorm:"type:VARCHAR(50);" json:"Category" yaml:"Category,omitempty"`
|
2020-09-13 17:51:43 +02:00
|
|
|
PlaceID string `gorm:"type:VARBINARY(42);default:'zz'" json:"-" yaml:"PlaceID"`
|
2020-07-12 08:27:05 +02:00
|
|
|
Place *Place `gorm:"PRELOAD:true" json:"Place" yaml:"-"`
|
|
|
|
CreatedAt time.Time `json:"CreatedAt" yaml:"-"`
|
|
|
|
UpdatedAt time.Time `json:"UpdatedAt" yaml:"-"`
|
2020-07-11 23:43:29 +02:00
|
|
|
}
|
|
|
|
|
2021-11-12 05:09:17 +01:00
|
|
|
// TableName returns the entity database table name.
|
|
|
|
func (Cell) TableName() string {
|
|
|
|
return "cells"
|
|
|
|
}
|
|
|
|
|
2020-07-12 04:48:17 +02:00
|
|
|
// UnknownLocation is PhotoPrism's default location.
|
2020-07-12 08:27:05 +02:00
|
|
|
var UnknownLocation = Cell{
|
2021-08-19 21:12:38 +02:00
|
|
|
ID: UnknownID,
|
2020-07-12 08:27:05 +02:00
|
|
|
Place: &UnknownPlace,
|
2021-08-19 21:12:38 +02:00
|
|
|
PlaceID: UnknownID,
|
2020-07-12 08:27:05 +02:00
|
|
|
CellName: "",
|
2021-11-18 00:46:34 +01:00
|
|
|
CellStreet: "",
|
|
|
|
CellPostcode: "",
|
2020-07-12 08:27:05 +02:00
|
|
|
CellCategory: "",
|
2020-05-25 19:10:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-12 04:48:17 +02:00
|
|
|
// CreateUnknownLocation creates the default location if not exists.
|
|
|
|
func CreateUnknownLocation() {
|
2021-11-25 12:48:07 +01:00
|
|
|
UnknownLocation = *FirstOrCreateCell(&UnknownLocation)
|
2019-12-20 20:23:16 +01:00
|
|
|
}
|
|
|
|
|
2020-07-12 08:27:05 +02:00
|
|
|
// NewCell creates a location using a token extracted from coordinate
|
|
|
|
func NewCell(lat, lng float32) *Cell {
|
|
|
|
result := &Cell{}
|
2019-12-20 20:23:16 +01:00
|
|
|
|
2020-06-05 16:49:32 +02:00
|
|
|
result.ID = s2.PrefixedToken(float64(lat), float64(lng))
|
2019-12-20 20:23:16 +01:00
|
|
|
|
|
|
|
return result
|
2018-09-17 18:40:57 +02:00
|
|
|
}
|
2019-12-16 20:22:46 +01:00
|
|
|
|
2021-11-12 05:09:17 +01:00
|
|
|
// Refresh updates the index by retrieving the latest data from an external API.
|
|
|
|
func (m *Cell) Refresh(api string) (err error) {
|
|
|
|
// Unknown?
|
|
|
|
if m.Unknown() {
|
|
|
|
// Skip.
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-11-18 00:46:34 +01:00
|
|
|
start := time.Now()
|
|
|
|
|
2021-11-12 05:09:17 +01:00
|
|
|
// Initialize.
|
|
|
|
l := &maps.Location{
|
|
|
|
ID: s2.NormalizeToken(m.ID),
|
|
|
|
}
|
|
|
|
|
2021-11-22 18:30:46 +01:00
|
|
|
cellMutex.Lock()
|
|
|
|
defer cellMutex.Unlock()
|
|
|
|
|
2021-12-09 01:10:15 +01:00
|
|
|
// Retrieve location details from Places API.
|
2021-11-12 05:09:17 +01:00
|
|
|
if err = l.QueryApi(api); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unknown location or label missing?
|
|
|
|
if l.Unknown() || l.Label() == "" {
|
|
|
|
// Ignore.
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-11-18 00:46:34 +01:00
|
|
|
oldPlaceID := m.PlaceID
|
2021-11-12 09:10:15 +01:00
|
|
|
|
2021-11-18 00:46:34 +01:00
|
|
|
place := Place{
|
|
|
|
ID: l.PlaceID(),
|
|
|
|
PlaceLabel: l.Label(),
|
|
|
|
PlaceDistrict: l.District(),
|
|
|
|
PlaceCity: l.City(),
|
|
|
|
PlaceState: l.State(),
|
|
|
|
PlaceCountry: l.CountryCode(),
|
|
|
|
PlaceKeywords: l.KeywordString(),
|
|
|
|
PhotoCount: 1,
|
2021-11-12 05:09:17 +01:00
|
|
|
}
|
|
|
|
|
2021-11-21 14:05:07 +01:00
|
|
|
m.Place = &place
|
|
|
|
m.PlaceID = l.PlaceID()
|
|
|
|
|
2021-11-18 00:46:34 +01:00
|
|
|
// Create or update place.
|
|
|
|
if err = place.Save(); err != nil {
|
2021-11-21 14:05:07 +01:00
|
|
|
log.Errorf("index: %s while saving place %s", err, place.ID)
|
2021-11-12 05:09:17 +01:00
|
|
|
} else {
|
2021-11-21 14:05:07 +01:00
|
|
|
log.Tracef("index: updated place %s", place.ID)
|
2021-11-12 05:09:17 +01:00
|
|
|
}
|
|
|
|
|
2021-11-18 00:46:34 +01:00
|
|
|
m.CellName = l.Name()
|
|
|
|
m.CellStreet = l.Street()
|
|
|
|
m.CellPostcode = l.Postcode()
|
|
|
|
m.CellCategory = l.Category()
|
|
|
|
|
|
|
|
// Update cell.
|
|
|
|
err = m.Save()
|
|
|
|
|
|
|
|
if err != nil {
|
2021-11-21 14:05:07 +01:00
|
|
|
log.Errorf("index: %s while updating cell %s [%s]", err, m.ID, time.Since(start))
|
2021-11-18 00:46:34 +01:00
|
|
|
return err
|
2021-11-21 14:05:07 +01:00
|
|
|
} else if oldPlaceID == m.PlaceID {
|
|
|
|
log.Tracef("index: cell %s keeps place_id %s", m.ID, m.PlaceID)
|
|
|
|
} else if err := UnscopedDb().Table(Photo{}.TableName()).
|
|
|
|
Where("place_id = ?", oldPlaceID).
|
2022-04-04 08:54:03 +02:00
|
|
|
UpdateColumn("place_id", m.PlaceID).
|
2021-11-21 14:05:07 +01:00
|
|
|
Error; err != nil {
|
|
|
|
log.Warnf("index: %s while changing place_id from %s to %s", err, oldPlaceID, m.PlaceID)
|
2021-11-18 00:46:34 +01:00
|
|
|
}
|
|
|
|
|
2021-11-21 14:05:07 +01:00
|
|
|
log.Debugf("index: updated cell %s [%s]", m.ID, time.Since(start))
|
2021-11-12 05:09:17 +01:00
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-05-26 12:46:22 +02:00
|
|
|
// Find retrieves location data from the database or an external api if not known already.
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) Find(api string) error {
|
2020-05-25 19:10:44 +02:00
|
|
|
start := time.Now()
|
2020-04-30 20:07:03 +02:00
|
|
|
db := Db()
|
|
|
|
|
2020-05-29 12:56:24 +02:00
|
|
|
if err := db.Preload("Place").First(m, "id = ?", m.ID).Error; err == nil {
|
2021-11-27 18:41:10 +01:00
|
|
|
log.Tracef("cell: found %s", m.ID)
|
2019-12-28 12:28:06 +01:00
|
|
|
return nil
|
2019-12-20 20:23:16 +01:00
|
|
|
}
|
|
|
|
|
2019-12-28 12:28:06 +01:00
|
|
|
l := &maps.Location{
|
2021-11-22 18:30:46 +01:00
|
|
|
ID: s2.NormalizeToken(m.ID),
|
2019-12-28 12:28:06 +01:00
|
|
|
}
|
|
|
|
|
2021-11-22 18:30:46 +01:00
|
|
|
cellMutex.Lock()
|
|
|
|
defer cellMutex.Unlock()
|
|
|
|
|
2021-12-09 01:10:15 +01:00
|
|
|
// Retrieve location details from Places API.
|
2020-01-11 01:59:43 +01:00
|
|
|
if err := l.QueryApi(api); err != nil {
|
2019-12-20 20:23:16 +01:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-11-20 16:36:34 +01:00
|
|
|
if found := FindPlace(l.PlaceID()); found != nil {
|
2020-07-07 16:56:02 +02:00
|
|
|
m.Place = found
|
2020-04-25 16:17:59 +02:00
|
|
|
} else {
|
2020-07-07 16:56:02 +02:00
|
|
|
place := &Place{
|
2021-11-18 00:46:34 +01:00
|
|
|
ID: l.PlaceID(),
|
2020-07-12 08:27:05 +02:00
|
|
|
PlaceLabel: l.Label(),
|
2021-11-18 00:46:34 +01:00
|
|
|
PlaceDistrict: l.District(),
|
2020-07-12 08:27:05 +02:00
|
|
|
PlaceCity: l.City(),
|
|
|
|
PlaceState: l.State(),
|
|
|
|
PlaceCountry: l.CountryCode(),
|
|
|
|
PlaceKeywords: l.KeywordString(),
|
|
|
|
PhotoCount: 1,
|
2020-04-25 16:17:59 +02:00
|
|
|
}
|
2020-05-25 19:10:44 +02:00
|
|
|
|
2020-07-16 14:00:22 +02:00
|
|
|
if createErr := place.Create(); createErr == nil {
|
2020-05-26 12:46:22 +02:00
|
|
|
event.Publish("count.places", event.Data{
|
|
|
|
"count": 1,
|
|
|
|
})
|
|
|
|
|
2021-11-27 18:41:10 +01:00
|
|
|
log.Infof("cell: added place %s [%s]", place.ID, time.Since(start))
|
2020-05-26 12:46:22 +02:00
|
|
|
|
2020-05-25 19:10:44 +02:00
|
|
|
m.Place = place
|
2021-11-20 16:36:34 +01:00
|
|
|
} else if found := FindPlace(l.PlaceID()); found != nil {
|
2020-07-07 16:56:02 +02:00
|
|
|
m.Place = found
|
|
|
|
} else {
|
2021-11-27 18:41:10 +01:00
|
|
|
log.Errorf("cell: %s while creating place %s", createErr, place.ID)
|
2020-07-07 16:56:02 +02:00
|
|
|
m.Place = &UnknownPlace
|
2020-05-25 19:10:44 +02:00
|
|
|
}
|
2019-12-28 20:24:20 +01:00
|
|
|
}
|
|
|
|
|
2020-05-29 12:56:24 +02:00
|
|
|
m.PlaceID = m.Place.ID
|
2020-07-12 08:27:05 +02:00
|
|
|
m.CellName = l.Name()
|
2021-11-18 00:46:34 +01:00
|
|
|
m.CellStreet = l.Street()
|
|
|
|
m.CellPostcode = l.Postcode()
|
2020-07-12 08:27:05 +02:00
|
|
|
m.CellCategory = l.Category()
|
2019-12-28 12:28:06 +01:00
|
|
|
|
2020-07-16 14:00:22 +02:00
|
|
|
if createErr := db.Create(m).Error; createErr == nil {
|
2021-11-27 18:41:10 +01:00
|
|
|
log.Debugf("cell: added %s [%s]", m.ID, time.Since(start))
|
2020-04-24 13:21:18 +02:00
|
|
|
return nil
|
2020-07-16 14:00:22 +02:00
|
|
|
} else if findErr := db.Preload("Place").First(m, "id = ?", m.ID).Error; findErr != nil {
|
2021-11-27 18:41:10 +01:00
|
|
|
log.Errorf("cell: %s (create %s)", createErr, m.ID)
|
|
|
|
log.Errorf("cell: %s (find %s)", findErr, m.ID)
|
2020-07-16 14:00:22 +02:00
|
|
|
return createErr
|
2020-05-25 19:10:44 +02:00
|
|
|
} else {
|
2021-11-27 18:41:10 +01:00
|
|
|
log.Tracef("cell: found %s [%s]", m.ID, time.Since(start))
|
2020-05-25 19:10:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create inserts a new row to the database.
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) Create() error {
|
2020-05-26 11:00:39 +02:00
|
|
|
return Db().Create(m).Error
|
2019-12-20 20:23:16 +01:00
|
|
|
}
|
|
|
|
|
2021-11-18 00:46:34 +01:00
|
|
|
// Save updates the existing or inserts a new row.
|
|
|
|
func (m *Cell) Save() error {
|
|
|
|
return Db().Save(m).Error
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delete removes the entity from the index.
|
|
|
|
func (m *Cell) Delete() (err error) {
|
|
|
|
return UnscopedDb().Delete(m).Error
|
|
|
|
}
|
|
|
|
|
2020-07-12 08:27:05 +02:00
|
|
|
// FirstOrCreateCell fetches an existing row, inserts a new row or nil in case of errors.
|
|
|
|
func FirstOrCreateCell(m *Cell) *Cell {
|
2020-05-29 12:56:24 +02:00
|
|
|
if m.ID == "" {
|
2021-11-27 18:41:10 +01:00
|
|
|
log.Errorf("cell: id missing")
|
2020-05-25 19:10:44 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-05-29 12:56:24 +02:00
|
|
|
if m.PlaceID == "" {
|
2021-11-27 18:41:10 +01:00
|
|
|
log.Errorf("cell: place id missing (find or create %s)", m.ID)
|
2020-05-25 19:10:44 +02:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-07-12 08:27:05 +02:00
|
|
|
result := Cell{}
|
2020-05-25 19:10:44 +02:00
|
|
|
|
2020-07-16 14:00:22 +02:00
|
|
|
if findErr := Db().Where("id = ?", m.ID).Preload("Place").First(&result).Error; findErr == nil {
|
2020-05-25 19:10:44 +02:00
|
|
|
return &result
|
2020-07-07 16:40:21 +02:00
|
|
|
} else if createErr := m.Create(); createErr == nil {
|
|
|
|
return m
|
2020-07-16 14:00:22 +02:00
|
|
|
} else if err := Db().Where("id = ?", m.ID).Preload("Place").First(&result).Error; err == nil {
|
2020-07-07 16:40:21 +02:00
|
|
|
return &result
|
|
|
|
} else {
|
2021-11-27 18:41:10 +01:00
|
|
|
log.Errorf("cell: %s (find or create %s)", createErr, m.ID)
|
2020-05-25 19:10:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-07 16:40:21 +02:00
|
|
|
return nil
|
2020-05-25 19:10:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-07 16:40:21 +02:00
|
|
|
// Keywords returns search keywords for a location.
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) Keywords() (result []string) {
|
2020-04-28 19:41:06 +02:00
|
|
|
if m.Place == nil {
|
2022-04-06 17:46:41 +02:00
|
|
|
log.Errorf("cell: info for %s is nil - possible bug", m.ID)
|
2020-04-28 19:41:06 +02:00
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
2021-11-18 00:46:34 +01:00
|
|
|
result = append(result, txt.Keywords(txt.ReplaceSpaces(m.District(), "-"))...)
|
2020-04-16 15:57:07 +02:00
|
|
|
result = append(result, txt.Keywords(txt.ReplaceSpaces(m.City(), "-"))...)
|
|
|
|
result = append(result, txt.Keywords(txt.ReplaceSpaces(m.State(), "-"))...)
|
|
|
|
result = append(result, txt.Keywords(txt.ReplaceSpaces(m.CountryName(), "-"))...)
|
2020-01-07 17:36:49 +01:00
|
|
|
result = append(result, txt.Keywords(m.Name())...)
|
2021-11-18 00:46:34 +01:00
|
|
|
result = append(result, txt.Keywords(m.Street())...)
|
|
|
|
result = append(result, txt.Keywords(m.Category())...)
|
2021-05-01 11:06:44 +02:00
|
|
|
result = append(result, txt.Words(m.Place.PlaceKeywords)...)
|
2019-12-20 20:23:16 +01:00
|
|
|
|
2020-03-25 14:14:00 +01:00
|
|
|
result = txt.UniqueWords(result)
|
|
|
|
|
2019-12-20 20:23:16 +01:00
|
|
|
return result
|
2019-12-16 20:22:46 +01:00
|
|
|
}
|
2019-12-28 12:28:06 +01:00
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// Unknown checks if the location has no id
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) Unknown() bool {
|
2020-07-12 04:48:17 +02:00
|
|
|
return m.ID == "" || m.ID == UnknownLocation.ID
|
2019-12-28 12:28:06 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// Name returns name of location
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) Name() string {
|
|
|
|
return m.CellName
|
2019-12-28 12:28:06 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// NoName checks if the location has no name
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) NoName() bool {
|
|
|
|
return m.CellName == ""
|
2019-12-28 20:24:20 +01:00
|
|
|
}
|
|
|
|
|
2021-11-18 00:46:34 +01:00
|
|
|
// Street returns the street name if any.
|
|
|
|
func (m *Cell) Street() string {
|
|
|
|
return m.CellStreet
|
|
|
|
}
|
|
|
|
|
|
|
|
// NoStreet checks if the location has a street.
|
|
|
|
func (m *Cell) NoStreet() bool {
|
|
|
|
return m.CellStreet == ""
|
|
|
|
}
|
|
|
|
|
|
|
|
// Postcode returns the postcode if any.
|
|
|
|
func (m *Cell) Postcode() string {
|
|
|
|
return m.CellPostcode
|
|
|
|
}
|
|
|
|
|
|
|
|
// NoPostcode checks if the location has a postcode.
|
|
|
|
func (m *Cell) NoPostcode() bool {
|
|
|
|
return m.CellPostcode == ""
|
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// Category returns the location category
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) Category() string {
|
|
|
|
return m.CellCategory
|
2019-12-28 12:28:06 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// NoCategory checks id the location has no category
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) NoCategory() bool {
|
|
|
|
return m.CellCategory == ""
|
2019-12-28 20:24:20 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// Label returns the location place label
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) Label() string {
|
2019-12-28 20:24:20 +01:00
|
|
|
return m.Place.Label()
|
2019-12-28 12:28:06 +01:00
|
|
|
}
|
|
|
|
|
2021-11-18 00:46:34 +01:00
|
|
|
// District returns the district name if any.
|
|
|
|
func (m *Cell) District() string {
|
|
|
|
return m.Place.District()
|
|
|
|
}
|
|
|
|
|
|
|
|
// City returns the location city name if any.
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) City() string {
|
2019-12-28 20:24:20 +01:00
|
|
|
return m.Place.City()
|
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// LongCity checks if the city name is more than 16 char
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) LongCity() bool {
|
2019-12-28 20:24:20 +01:00
|
|
|
return len(m.City()) > 16
|
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// NoCity checks if the location has no city
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) NoCity() bool {
|
2019-12-28 20:24:20 +01:00
|
|
|
return m.City() == ""
|
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// CityContains checks if the location city contains the text string
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) CityContains(text string) bool {
|
2019-12-28 20:24:20 +01:00
|
|
|
return strings.Contains(text, m.City())
|
2019-12-28 12:28:06 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// State returns the location place state
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) State() string {
|
2019-12-28 20:24:20 +01:00
|
|
|
return m.Place.State()
|
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// NoState checks if the location place has no state
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) NoState() bool {
|
2019-12-28 20:24:20 +01:00
|
|
|
return m.Place.State() == ""
|
2019-12-28 12:28:06 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// CountryCode returns the location place country code
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) CountryCode() string {
|
2019-12-28 20:24:20 +01:00
|
|
|
return m.Place.CountryCode()
|
2019-12-28 12:28:06 +01:00
|
|
|
}
|
|
|
|
|
2020-02-21 01:14:45 +01:00
|
|
|
// CountryName returns the location place country name
|
2020-07-12 08:27:05 +02:00
|
|
|
func (m *Cell) CountryName() string {
|
2019-12-28 20:24:20 +01:00
|
|
|
return m.Place.CountryName()
|
|
|
|
}
|