mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Add Geo commands read-only variants
This commit is contained in:
20
command.go
20
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,
|
||||
|
Reference in New Issue
Block a user