Documentation
¶
Overview ¶
Package go-cities.json is Go's mirror for https://github.com/lutangar/cities.json with Go's embed support.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Cities []*City
)
Functions ¶
func All ¶ added in v0.6.0
Example ¶
package main
import (
"fmt"
gocitiesjson "github.com/ringsaturn/go-cities.json"
)
func main() {
c := 0
for city := range gocitiesjson.All(false) {
_ = city
c++
}
fmt.Println(c > 10000)
}
Output: true
func Filter ¶ added in v0.6.0
Example ¶
package main
import (
"fmt"
gocitiesjson "github.com/ringsaturn/go-cities.json"
)
func main() {
c := 0
bboxFilter := func(city *gocitiesjson.City) bool {
return city.Lng > 0 && city.Lng < 10 && city.Lat > 0 && city.Lat < 10
}
for city := range gocitiesjson.Filter(bboxFilter, false) {
_ = city
c++
}
fmt.Println(c > 0)
}
Output: true
Types ¶
Click to show internal directories.
Click to hide internal directories.