mirror of
https://github.com/chubin/wttr.in
synced 2025-01-12 20:18:46 +00:00
26 lines
490 B
Go
26 lines
490 B
Go
package location
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
)
|
|
|
|
type Location struct {
|
|
Name string `db:"name,key"`
|
|
Lat string `db:"lat"`
|
|
Lon string `db:"lon"`
|
|
Timezone string `db:"timezone"`
|
|
//nolint:tagliatelle
|
|
Fullname string `db:"displayName" json:"display_name"`
|
|
}
|
|
|
|
// String returns string representation of location.
|
|
func (l *Location) String() string {
|
|
bytes, err := json.Marshal(l)
|
|
if err != nil {
|
|
// should never happen
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
return string(bytes)
|
|
}
|