summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaixintao <laixintaoo@gmail.com>2022-06-25 23:46:02 +0800
committerlaixintao <laixintaoo@gmail.com>2022-06-25 23:46:02 +0800
commit94c6c1f7a803a3dceb3be3a6bb959589050f8324 (patch)
treec0b583e3d46f1a7654237b76e0d0953deeb01423
parente2bc831bd6564a87c08becd9bde96cfe5a03602e (diff)
geosearchstore.
-rw-r--r--CHANGELOG.md1
-rw-r--r--iredis/data/command_syntax.csv1
-rw-r--r--iredis/redis_grammar.py1
-rw-r--r--tests/unittests/command_parse/test_geo.py11
4 files changed, 14 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3b165ae..0d80536 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@
- Feature: support new command: `EXPIRETIME`.
- Feature: support new command: `FAILOVER`.
- Feature: support new command: `GEOSEARCH`.
+- Feature: support new command: `GEOSEARCHRESTORE`.
- Feature: `FLUSHDB` and `FLUSHALL` supports `SYNC` option.
- Feature: `GEOADD` supports `CH XX NX` options.
- Deprecate: `GEORADIUS` is deprecated, no auto-complete for this command anymore.
diff --git a/iredis/data/command_syntax.csv b/iredis/data/command_syntax.csv
index a701c78..b68559a 100644
--- a/iredis/data/command_syntax.csv
+++ b/iredis/data/command_syntax.csv
@@ -76,6 +76,7 @@ geo,GEOPOS,command_key_members,render_list
geo,GEORADIUS,command_any,render_list_or_string
geo,GEORADIUSBYMEMBER,command_any,render_list_or_string
geo,GEOSEARCH,command_key_any,render_list
+geo,GEOSEARCHSTORE,command_key_key_any,render_list
hash,HDEL,command_key_fields,render_int
hash,HEXISTS,command_key_field,render_int
hash,HGET,command_key_field,render_bulk_string
diff --git a/iredis/redis_grammar.py b/iredis/redis_grammar.py
index 7d982c7..0f8b399 100644
--- a/iredis/redis_grammar.py
+++ b/iredis/redis_grammar.py
@@ -455,6 +455,7 @@ GRAMMAR = {
"command_object_key": rf"\s+ {OBJECT} \s+ {KEY} \s*",
"command_key_member": rf"\s+ {KEY} \s+ {MEMBER} \s*",
"command_key_any": rf"\s+ {KEY} \s+ {ANY} \s*",
+ "command_key_key_any": rf"\s+ {KEY} \s+ {KEY} \s+ {ANY} \s*",
"command_key_newkey_member": rf"\s+ {KEY} \s+ {NEWKEY} \s+ {MEMBER} \s*",
"command_key_count_x": rf"\s+ {KEY} (\s+ {COUNT})? \s*",
"command_key_min_max": rf"\s+ {KEY} \s+ {MIN} \s+ {MAX} \s*",
diff --git a/tests/unittests/command_parse/test_geo.py b/tests/unittests/command_parse/test_geo.py
index b5bfa29..8502696 100644
--- a/tests/unittests/command_parse/test_geo.py
+++ b/tests/unittests/command_parse/test_geo.py
@@ -32,3 +32,14 @@ def test_geosearch(judge_command):
"any": "FROMLONLAT 15 37 BYBOX 400 400 km ASC WITHCOORD WITHDIST",
},
)
+
+
+def test_geosearchstore(judge_command):
+ judge_command(
+ "GEOSEARCHSTORE key2 Sicily FROMLONLAT 15 37 BYBOX 400 400 km ASC COUNT 3 STOREDIST",
+ {
+ "command": "GEOSEARCHSTORE",
+ "key": ["Sicily", "key2"],
+ "any": "FROMLONLAT 15 37 BYBOX 400 400 km ASC COUNT 3 STOREDIST",
+ },
+ )