Skip to content

Commit ecbb30e

Browse files
authored
Merge branch 'master' into omer_test_outofrange
2 parents f375aee + 6b30093 commit ecbb30e

25 files changed

+578
-238
lines changed

.github/wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ PyPi
2929
README
3030
RSALv
3131
Rafa
32+
Redisson
3233
ReJSON
3334
RediSearch
3435
RedisJSON

Cargo.lock

Lines changed: 146 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ categories = ["database-implementations"]
1616
crate-type = ["cdylib", "rlib"]
1717
name = "rejson"
1818

19+
[dev-dependencies]
20+
env_logger = "0.10.0"
21+
#redis-module = { version="1.0", features = ["experimental-api", "test"]}
22+
1923
[dependencies]
2024
pest = "2.1"
2125
pest_derive = "2.1"

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![macos](https://github.com/RedisJSON/RedisJSON/workflows/macos/badge.svg)](https://github.com/RedisJSON/RedisJSON/actions?query=workflow%3Amacos)
44
[![Dockerhub](https://img.shields.io/badge/dockerhub-redislabs%2Frejson-blue)](https://hub.docker.com/r/redislabs/rejson/tags/)
55
[![Codecov](https://codecov.io/gh/RedisJSON/RedisJSON/branch/master/graph/badge.svg)](https://codecov.io/gh/RedisJSON/RedisJSON)
6-
[![Total alerts](https://img.shields.io/lgtm/alerts/g/RedisJSON/RedisJSON.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/RedisJSON/RedisJSON/alerts/)
76

87
# RedisJSON
98
[![Forum](https://img.shields.io/badge/Forum-RedisJSON-blue)](https://forum.redislabs.com/c/modules/redisjson)
@@ -73,6 +72,7 @@ Some languages have client libraries that provide support for RedisJSON's comman
7372
| [redis-om-python][redis-om-python-url] | Python | BSD-3-Clause | [Redis][redis-om-python-author] | [![redis-om-python-stars]][redis-om-python-url] | [PyPi][redis-om-python-package] |
7473
| [Jedis][Jedis-url] | Java | MIT | [Redis][JRedisJSON-author] | [![Jedis-stars]][Jedis-url] | [Maven][Jedis-package] |
7574
| [JRedisJSON][JRedisJSON-url] | Java | BSD-2-Clause | [Redis Labs][JRedisJSON-author] | [![JRedisJSON-stars]][JRedisJSON-url] | [maven][JRedisJSON-package] | Deprecated |
75+
| [Redisson][Redisson-url] | Java | Apache-2.0 | [Redisson][Redisson-author] | [![Redisson-stars]][Redisson-url] | [Maven][Redisson-package] |
7676
| [redis-modules-java][redis-modules-java-url] | Java | Apache-2.0 | [Liming Deng @dengliming][redis-modules-java-author] | [![redis-modules-java-stars]][redis-modules-java-url] | [maven][redis-modules-java-package] |
7777
| [redis-om-spring][redis-om-spring-url] | Java | BSD-3-Clause | [Redis][redis-om-spring-author] | [![redis-om-spring-stars]][redis-om-spring-url] | |
7878
| [node-redis][node-redis-url] | Node.js | MIT | [Redis][node-redis-author] | [![node-redis-stars]][node-redis-url] | [npm][node-redis-package] |
@@ -100,6 +100,11 @@ Some languages have client libraries that provide support for RedisJSON's comman
100100
[JRedisJSON-package]: https://search.maven.org/artifact/com.redislabs/jrejson/
101101
[JRedisJSON-stars]: https://img.shields.io/github/stars/RedisJSON/JRedisJSON.svg?style=social&label=Star&maxAge=2592000
102102

103+
[Redisson-author]: https://github.com/redisson/
104+
[Redisson-url]: https://github.com/redisson/redisson
105+
[Redisson-package]: https://search.maven.org/artifact/org.redisson/redisson/
106+
[Redisson-stars]: https://img.shields.io/github/stars/redisson/redisson.svg?style=social&label=Star&maxAge=2592000
107+
103108
[redis-modules-java-author]: https://github.com/dengliming/
104109
[redis-modules-java-url]: https://github.com/dengliming/redis-modules-java
105110
[redis-modules-java-package]: https://search.maven.org/artifact/io.github.dengliming.redismodule/redis-modules-java/

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ use std::process::Command;
99
fn main() {
1010
// Expose GIT_SHA env var
1111
let git_sha = Command::new("git")
12-
.args(&["rev-parse", "--short", "HEAD"])
12+
.args(["rev-parse", "--short", "HEAD"])
1313
.output();
1414
if let Ok(sha) = git_sha {
1515
let sha = String::from_utf8(sha.stdout).unwrap();
1616
println!("cargo:rustc-env=GIT_SHA={}", sha);
1717
}
1818
// Expose GIT_BRANCH env var
1919
let git_branch = Command::new("git")
20-
.args(&["rev-parse", "--abbrev-ref", "HEAD"])
20+
.args(["rev-parse", "--abbrev-ref", "HEAD"])
2121
.output();
2222
if let Ok(branch) = git_branch {
2323
let branch = String::from_utf8(branch.stdout).unwrap();

docs/commands/json.arrindex.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Search for the first occurrence of a scalar JSON value in an array
1+
Search for the first occurrence of a JSON value in an array
22

33
[Examples](#examples)
44

docs/commands/json.get.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ is JSONPath to specify. Default is root `$`. JSON.GET accepts multiple `path` ar
1717

1818
{{% alert title="Note" color="warning" %}}
1919

20-
When using a JSONPath, the root of the matching values is always an array. In contrast, the legacy path returns a single value.
20+
When using a single JSONPath, the root of the matching values is a JSON string with a top-level **array** of serialized JSON value.
21+
In contrast, a legacy path returns a single value.
22+
23+
When using multiple JSONPath arguments, the root of the matching values is a JSON string with a top-level **object**, with each object value being a top-level array of serialized JSON value.
24+
In contrast, if all paths are legacy paths, each object value is a single serialized JSON value.
2125
If there are multiple paths that include both legacy path and JSONPath, the returned value conforms to the JSONPath version (an array of values).
2226

2327
{{% /alert %}}
@@ -52,7 +56,10 @@ Produce pretty-formatted JSON with `redis-cli` by following this example:
5256

5357
## Return
5458

55-
JSON.GET returns an array of bulk string replies. Each string is the JSON serialization of each JSON value that matches a path.
59+
JSON.GET returns a bulk string representing a JSON array of string replies.
60+
Each string is the JSON serialization of each JSON value that matches a path.
61+
Using multiple paths, JSON.GET returns a bulk string representing a JSON object with string values.
62+
Each string value is an array of the JSON serialization of each JSON value that matches a path.
5663
For more information about replies, see [Redis serialization protocol specification](/docs/reference/protocol-spec).
5764

5865
## Examples
@@ -63,7 +70,7 @@ For more information about replies, see [Redis serialization protocol specificat
6370
Create a JSON document.
6471

6572
{{< highlight bash >}}
66-
127.0.0.1:6379> JSON.SET doc $ '{"a":2, "b": 3, "nested": {"a": 4, "b": null}}'
73+
127.0.0.1:6379> JSON.SET doc $ '{"a":2, "b": 3, "nested": {"a": 4, "b": null}}'
6774
OK
6875
{{< / highlight >}}
6976

@@ -74,7 +81,7 @@ With a single JSONPath (JSON array bulk string):
7481
"[3,null]"
7582
{{< / highlight >}}
7683

77-
Using multiple paths with at least one JSONPath (map with array of JSON values per path):
84+
Using multiple paths with at least one JSONPath returns a JSON string with a top-level object with an array of JSON values per path:
7885

7986
{{< highlight bash >}}
8087
127.0.0.1:6379> JSON.GET doc ..a $..b

docs/docs/_index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,28 @@ dog = r.json().get('doc', '$.dog')
151151
scientific_name = r.json().get('doc', '$..scientific-name')
152152
```
153153

154+
### Run with Docker
155+
156+
To run RedisJSON with Docker, use the `redis-stack-server` Docker image:
157+
158+
```sh
159+
$ docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
160+
```
161+
162+
For more information about running Redis Stack in a Docker container, see [Run Redis Stack on Docker](/docs/stack/get-started/install/docker/).
163+
164+
### Download binaries
165+
166+
To download and run RedisJSON from a precompiled binary:
167+
168+
1. Download a precompiled version of RediSearch from the [Redis download center](https://redis.com/download-center/modules/).
169+
170+
1. Run Redis with RedisJSON:
171+
172+
```sh
173+
$ redis-server --loadmodule /path/to/module/src/rejson.so
174+
```
175+
154176
### Build from source
155177

156178
To build RedisJSON from the source code:

docs/docs/path.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ RedisJSON supports two query syntaxes: [JSONPath syntax](#jsonpath-syntax) and t
1111

1212
RedisJSON knows which syntax to use depending on the first character of the path query. If the query starts with the character `$`, it uses JSONPath syntax. Otherwise, it defaults to the legacy path syntax.
1313

14+
The returned value is a JSON string with a top-level array of JSON serialized strings.
15+
And if multi-paths are used, the return value is a JSON string with a top-level object with values that are arrays of serialized JSON values.
16+
1417
## JSONPath support
1518

16-
RedisJSON v2.0 introduces [JSONPath](http://goessner.net/articles/JsonPath/) support. It follows the syntax described by Goessner in his [article](http://goessner.net/articles/JsonPath/).
19+
RedisJSON v2.0 introduced [JSONPath](http://goessner.net/articles/JsonPath/) support. It follows the syntax described by Goessner in his [article](http://goessner.net/articles/JsonPath/).
1720

1821
A JSONPath query can resolve to several locations in a JSON document. In this case, the JSON commands apply the operation to every possible location. This is a major improvement over [legacy path](#legacy-path-syntax) queries, which only operate on the first path.
1922

src/array_index.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*
2-
* Copyright Redis Ltd. 2016 - present
3-
* Licensed under your choice of the Redis Source Available License 2.0 (RSALv2) or
4-
* the Server Side Public License v1 (SSPLv1).
5-
*/
6-
7-
pub(crate) trait ArrayIndex {
1+
/*
2+
* Copyright Redis Ltd. 2016 - present
3+
* Licensed under your choice of the Redis Source Available License 2.0 (RSALv2) or
4+
* the Server Side Public License v1 (SSPLv1).
5+
*/
6+
7+
pub trait ArrayIndex {
88
fn normalize(self, len: i64) -> usize;
99
}
1010

0 commit comments

Comments
 (0)