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

Method GEOPOS

geo.go:147–167  ·  view source on GitHub ↗

GEOPOS returns the stored locations for each of the given members, as a map of member to location. If a member cannot be found, it will not be present in the returned map. Cost is O(1) / 1 RCU for each member. Works similar to https://redis.io/commands/geopos

(key string, members ...string)

Source from the content-addressed store, hash-verified

145//
146// Works similar to https://redis.io/commands/geopos
147func (c Client) GEOPOS(key string, members ...string) (locations map[string]GLocation, err error) {
148 locations = make(map[string]GLocation)
149
150 for _, member := range members {
151 resp, err := c.ddbClient.GetItemRequest(&dynamodb.GetItemInput{
152 ConsistentRead: aws.Bool(c.consistentReads),
153 Key: keyDef{pk: key, sk: member}.toAV(c),
154 TableName: aws.String(c.table),
155 }).Send(context.TODO())
156
157 if err != nil {
158 return locations, err
159 }
160
161 if len(resp.Item) > 0 {
162 locations[member] = fromCellIDString(aws.StringValue(resp.Item[c.skN].N))
163 }
164 }
165
166 return
167}
168
169// GEORADIUS returns the members (limited to the given count) that are located within the given radius
170// of the given center. Note that the positions are returned in no particular order – if there are more

Callers 4

GEODISTMethod · 0.95
GEOHASHMethod · 0.95
GEORADIUSBYMEMBERMethod · 0.95
TestGeoBasicsFunction · 0.80

Calls 3

fromCellIDStringFunction · 0.85
toAVMethod · 0.45
StringMethod · 0.45

Tested by 1

TestGeoBasicsFunction · 0.64