diff --git a/command.go b/command.go index 361661a..0e5b201 100644 --- a/command.go +++ b/command.go @@ -799,7 +799,9 @@ type GeoRadiusQuery struct { WithGeoHash bool Count int // Can be ASC or DESC. Default is no sort order. - Sort string + Sort string + Store string + StoreDist string } type GeoLocationCmd struct { @@ -817,20 +819,28 @@ func NewGeoLocationCmd(q *GeoRadiusQuery, args ...interface{}) *GeoLocationCmd { args = append(args, "km") } if q.WithCoord { - args = append(args, "WITHCOORD") + args = append(args, "withcoord") } if q.WithDist { - args = append(args, "WITHDIST") + args = append(args, "withdist") } if q.WithGeoHash { - args = append(args, "WITHHASH") + args = append(args, "withhash") } if q.Count > 0 { - args = append(args, "COUNT", q.Count) + args = append(args, "count", q.Count) } if q.Sort != "" { args = append(args, q.Sort) } + if q.Store != "" { + args = append(args, "store") + args = append(args, q.Store) + } + if q.StoreDist != "" { + args = append(args, "storedist") + args = append(args, q.StoreDist) + } return &GeoLocationCmd{ baseCmd: baseCmd{_args: args}, q: q, diff --git a/commands.go b/commands.go index 4ea7877..ac7c6cc 100644 --- a/commands.go +++ b/commands.go @@ -234,7 +234,9 @@ type Cmdable interface { GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd GeoPos(key string, members ...string) *GeoPosCmd GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd + GeoRadiusRO(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd + GeoRadiusByMemberRO(key, member string, query *GeoRadiusQuery) *GeoLocationCmd GeoDist(key string, member1, member2, unit string) *FloatCmd GeoHash(key string, members ...string) *StringSliceCmd Command() *CommandsInfoCmd @@ -2061,12 +2063,24 @@ func (c *cmdable) GeoRadius(key string, longitude, latitude float64, query *GeoR return cmd } +func (c *cmdable) GeoRadiusRO(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd { + cmd := NewGeoLocationCmd(query, "georadius_ro", key, longitude, latitude) + c.process(cmd) + return cmd +} + func (c *cmdable) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd { cmd := NewGeoLocationCmd(query, "georadiusbymember", key, member) c.process(cmd) return cmd } +func (c *cmdable) GeoRadiusByMemberRO(key, member string, query *GeoRadiusQuery) *GeoLocationCmd { + cmd := NewGeoLocationCmd(query, "georadiusbymember_ro", key, member) + c.process(cmd) + return cmd +} + func (c *cmdable) GeoDist(key string, member1, member2, unit string) *FloatCmd { if unit == "" { unit = "km"