MCPcopy Create free account
hub / github.com/dbProjectRED/redimo.go / GEOHASH

Method GEOHASH

geo.go:128–139  ·  view source on GitHub ↗

GEOHASH returns the Geohash strings (see https://en.wikipedia.org/wiki/Geohash) of the given members. If any members were not found, they will not be present in the returned map. Cost is O(1) / 1 RCU for each member. Works similar to https://redis.io/commands/geohash

(key string, members ...string)

Source from the content-addressed store, hash-verified

126//
127// Works similar to https://redis.io/commands/geohash
128func (c Client) GEOHASH(key string, members ...string) (geohashes map[string]string, err error) {
129 geohashes = make(map[string]string)
130 locations, err := c.GEOPOS(key, members...)
131
132 for _, member := range members {
133 if location, found := locations[member]; found {
134 geohashes[member] = location.Geohash()
135 }
136 }
137
138 return
139}
140
141// GEOPOS returns the stored locations for each of the given members, as a map of member to location.
142// If a member cannot be found, it will not be present in the returned map.

Callers 1

TestGeoBasicsFunction · 0.80

Calls 2

GEOPOSMethod · 0.95
GeohashMethod · 0.80

Tested by 1

TestGeoBasicsFunction · 0.64