-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support geo commands in lettuce 3.3 #86
- Loading branch information
Showing
12 changed files
with
686 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.lambdaworks.redis; | ||
|
||
import com.lambdaworks.redis.protocol.CommandArgs; | ||
|
||
/** | ||
* @author <a href="mailto:mpaluch@paluch.biz">Mark Paluch</a> | ||
*/ | ||
public class GeoArgs { | ||
|
||
private boolean withdistance; | ||
private boolean withcoordinates; | ||
private boolean withhash; | ||
private boolean noproperties; | ||
private Sort sort = Sort.none; | ||
|
||
public GeoArgs withDistance() { | ||
withdistance = true; | ||
return this; | ||
} | ||
|
||
public GeoArgs withCoordinates() { | ||
withcoordinates = true; | ||
return this; | ||
} | ||
|
||
public GeoArgs withHash() { | ||
withhash = true; | ||
return this; | ||
} | ||
|
||
public GeoArgs noProperties() { | ||
noproperties = true; | ||
return this; | ||
} | ||
|
||
public GeoArgs asc() { | ||
return sort(Sort.asc); | ||
} | ||
|
||
public GeoArgs desc() { | ||
return sort(Sort.desc); | ||
} | ||
|
||
public GeoArgs sort(Sort sort) { | ||
this.sort = sort; | ||
return this; | ||
} | ||
|
||
public enum Sort { | ||
asc, desc, none; | ||
} | ||
|
||
public enum Unit { | ||
meter, kilometer, feet, mile; | ||
} | ||
|
||
public <K, V> void build(CommandArgs<K, V> args) { | ||
if (withdistance) { | ||
args.add("withdistance"); | ||
} | ||
|
||
if (withcoordinates) { | ||
args.add("withcoordinates"); | ||
} | ||
|
||
if (withhash) { | ||
args.add("withhash"); | ||
} | ||
|
||
if (noproperties) { | ||
args.add("noproperties"); | ||
} | ||
|
||
if (sort != null && sort != Sort.none) { | ||
args.add(sort.name()); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.