Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix issue #4 - ZRangeByScoreCommand fails to handle min/max #9

Merged
merged 1 commit into from

2 participants

@dsklyut

Also:
1. enable zadd Command
2. few more .gitignore entries to handle Idea files/directories

@dsklyut dsklyut fix issue #4 - ZRangeByScoreCommand fails to handle min/max
enable zadd Command

few more .gitignore entries to handle Idea files/directories
1ee210a
@thmarx thmarx merged commit e72c29e into thmarx:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 15, 2013
  1. @dsklyut

    fix issue #4 - ZRangeByScoreCommand fails to handle min/max

    dsklyut authored
    enable zadd Command
    
    few more .gitignore entries to handle Idea files/directories
This page is out of date. Refresh to see the latest.
View
6 .gitignore
@@ -4,4 +4,8 @@ target/
.project
build/
bin
-.gradle
+.gradle
+*.iml
+*.ipr
+*.iws
+.idea/
View
30 src/main/java/net/ml/vertx/mods/redis/commands/sortedsets/ZRangeByScoreCommand.java
@@ -30,7 +30,7 @@
/**
* ZRangeByScoreCommand
* <p>
- *
+ *
* @author <a href="http://marx-labs.de">Thorsten Marx</a>
*/
public class ZRangeByScoreCommand extends Command {
@@ -45,25 +45,25 @@ public ZRangeByScoreCommand() {
public void handle(final Message<JsonObject> message, CommandContext context) throws CommandException {
String key = getMandatoryString("key", message);
checkNull(key, "key can not be null");
-
-
- Object min = message.body.getObject("min");
+
+
+ Object min = message.body.getField("min");
checkNull(min, "min can not be null");
checkType(min, "min must be of type double or string", new Class[] {Double.class, String.class});
-
- Object max = message.body.getObject("max");
+
+ Object max = message.body.getField("max");
checkNull(max, "max can not be null");
checkType(max, "max must be of type double or string", new Class[] {Double.class, String.class});
-
+
Number offset = message.body.getNumber("offset");
-
+
Number count = message.body.getNumber("count");
-
-
+
+
try {
-
- Future<List<String>> responseFuture = null;
-
+
+ Future<List<String>> responseFuture = null;
+
if (min instanceof String && max instanceof String) {
if (count != null && offset != null) {
responseFuture = context.getConnection().zrangebyscore(key, (String)min, (String)max, offset.intValue(), count.intValue());
@@ -81,7 +81,7 @@ public void handle(final Message<JsonObject> message, CommandContext context) th
}
List<String> response_values = responseFuture.get();
-
+
JsonArray response;
if (response_values != null && !response_values.isEmpty()) {
response = new JsonArray(response_values.toArray());
@@ -89,7 +89,7 @@ public void handle(final Message<JsonObject> message, CommandContext context) th
response = new JsonArray();
}
response(message, response);
-
+
} catch (Exception e) {
sendError(message, e.getLocalizedMessage());
}
View
2  src/main/resources/META-INF/services/net.ml.vertx.mods.redis.commands.Command
@@ -62,7 +62,7 @@ net.ml.vertx.mods.redis.commands.sets.SRemCommand
net.ml.vertx.mods.redis.commands.sets.SUnionCommand
net.ml.vertx.mods.redis.commands.sets.SUnionStoreCommand
-#net.ml.vertx.mods.redis.commands.sortedsets.ZAddCommand
+net.ml.vertx.mods.redis.commands.sortedsets.ZAddCommand
net.ml.vertx.mods.redis.commands.sortedsets.ZCardCommand
net.ml.vertx.mods.redis.commands.sortedsets.ZCountCommand
net.ml.vertx.mods.redis.commands.sortedsets.ZIncrByCommand
Something went wrong with that request. Please try again.