2022-12-09 20:02:10 +00:00
|
|
|
package location
|
|
|
|
|
2022-12-11 08:36:11 +00:00
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"log"
|
|
|
|
)
|
2022-12-09 20:02:10 +00:00
|
|
|
|
|
|
|
type Location struct {
|
2022-12-11 08:36:11 +00:00
|
|
|
Name string `db:"name,key"`
|
|
|
|
Lat string `db:"lat"`
|
|
|
|
Lon string `db:"lon"`
|
|
|
|
Timezone string `db:"timezone"`
|
2022-12-11 13:28:34 +00:00
|
|
|
//nolint:tagliatelle
|
|
|
|
Fullname string `db:"displayName" json:"display_name"`
|
2022-12-11 08:36:11 +00:00
|
|
|
}
|
|
|
|
|
2022-12-11 13:28:34 +00:00
|
|
|
// String returns string representation of location.
|
2022-12-11 08:36:11 +00:00
|
|
|
func (l *Location) String() string {
|
|
|
|
bytes, err := json.Marshal(l)
|
|
|
|
if err != nil {
|
|
|
|
// should never happen
|
|
|
|
log.Fatalln(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return string(bytes)
|
2022-12-09 20:02:10 +00:00
|
|
|
}
|