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)
| 145 | // |
| 146 | // Works similar to https://redis.io/commands/geopos |
| 147 | func (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 |