Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f63f5e4
initial commit for multi index
gkorland Oct 13, 2021
0433a87
fix case when nothing is found in the array
gkorland Oct 13, 2021
12c78cf
format code
gkorland Oct 13, 2021
b8ce884
add tests and fix test
gkorland Oct 14, 2021
d47d138
Multi path: arrindex handle multi
oshadmi Oct 15, 2021
c8682b5
Multi path: arrindex handle multi - fix tests and update doc
oshadmi Oct 16, 2021
2c1c787
Multi path: arrindex - `stop` index can be negative
oshadmi Oct 16, 2021
08378d7
Multi path: arrindex - per Guy's review
oshadmi Oct 17, 2021
65a6fc5
Multi path: arrindex - fix legacy test with none-scalar value
oshadmi Oct 17, 2021
2e48080
Multi path: del - add test and doc
oshadmi Oct 17, 2021
e77daf1
WIP [skip ci] Multi path: get multi value and multi path
oshadmi Oct 17, 2021
13b69fb
Multi path: fix multi value/path (not yet resp array)
oshadmi Oct 18, 2021
6b2ce78
Multi path: mget multi value/path and test fixes
oshadmi Oct 19, 2021
a1fbcb3
Multi path: numincrby nummultby numpowby
oshadmi Oct 20, 2021
378b050
Multi path: get fails with legacy path
oshadmi Oct 20, 2021
8aeb435
Multi path: Try using jsonpath lib api select_values_with_paths
oshadmi Oct 20, 2021
0b6dedb
Multi path: Workaround without jsonpath lib api select_values_with_paths
oshadmi Oct 20, 2021
04cf95c
Multi path: arrindex - fixes per Gavrie's review
oshadmi Oct 21, 2021
e7c8439
Multi path: strappend strlen
oshadmi Oct 22, 2021
8a6e55c
Multi path: arrappend
oshadmi Oct 23, 2021
a4ad038
Multi path: arrinsert
oshadmi Oct 23, 2021
850a738
Multi path: arrlen
oshadmi Oct 23, 2021
5f3d408
Multi path: arrpop
oshadmi Oct 24, 2021
3faec15
Multi path: arrtrim
oshadmi Oct 24, 2021
331079b
Multi path: avoid crash in arrtrim (fix ArrayIndex normalize)
oshadmi Oct 24, 2021
793c0f5
Multi path: objkeys
oshadmi Oct 25, 2021
0db42d4
Multi path: objlen and type commands
oshadmi Oct 26, 2021
787fc56
Multi path: toggle command
oshadmi Oct 26, 2021
bd4d2a7
Multi path: debug memory commands
oshadmi Oct 26, 2021
80192da
Multi path: debug memory fix test
oshadmi Oct 26, 2021
8e0e119
Multi path: json.type without get_type_name api
oshadmi Oct 26, 2021
e9e4cb4
Multi path: json.resp
oshadmi Oct 26, 2021
30304ad
Multi path: temporarily build macos *on-any-branch
oshadmi Oct 26, 2021
beed0ea
Multi path: restore legacy backward compatibility for numXby strlen s…
oshadmi Oct 26, 2021
11459b5
Merge remote-tracking branch 'origin/master' into omer_multipath_1
oshadmi Oct 26, 2021
ad13b73
Multi path: arrindex - fixes per Gavrie's review (2)
oshadmi Oct 27, 2021
46f76d0
Merge remote-tracking branch 'origin/master' into multi_arr_index
oshadmi Oct 27, 2021
39ba233
Merge remote-tracking branch 'origin/multi_arr_index' into omer_multi…
oshadmi Oct 27, 2021
5b8d88f
Merge branch 'master' into omer_multipath_2
rafie Oct 27, 2021
ec6b79a
Build and upload artifacts
rafie Oct 27, 2021
2f8465d
Merge remote-tracking branch 'origin/master' into omer_multipath_2
oshadmi Oct 27, 2021
a79ea2b
Multipath - per Meir's review (1)
oshadmi Oct 27, 2021
3f04a12
Merge remote-tracking branch 'origin/omer_multipath_2' into omer_mult…
oshadmi Oct 28, 2021
4fcadf8
Multipath - per Meir's review (2)
oshadmi Oct 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,24 +384,28 @@ workflows:
<<: *not-on-integ-branch
- platforms-build:
context: common
<<: *on-integ-and-version-tags
#@@ <<: *on-integ-and-version-tags
<<: *not-on-integ-branch
matrix:
parameters:
platform: [focal, bionic, xenial, centos8, centos7, bullseye]
- build-macos:
<<: *on-integ-and-version-tags
#@ <<: *on-integ-and-version-tags
<<: *on-any-branch
- deploy-artifacts:
name: deploy_snapshot
location: snapshots
context: common
<<: *on-integ-branch
#@@<<: *on-integ-branch
<<: *not-on-integ-branch
requires:
- platforms-build
- build-macos
- deploy-artifacts:
name: deploy_release
context: common
<<: *on-version-tags
#@@ <<: *on-version-tags
<<: *not-on-integ-branch
requires:
- platforms-build
- build-macos
Expand Down
66 changes: 33 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deps/readies
11 changes: 6 additions & 5 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ Pretty-formatted JSON is producible with `redis-cli` by following this example:

#### Return value

[Bulk String][3], specifically the JSON serialization.

The reply's structure depends on the number of paths. A single path results in the value itself being returned, whereas multiple paths are returned as a JSON object in which each path is a key.
[Array][4] of [Bulk Strings][3], specifically, each string is the JSON serialization of each JSON value matching a path.

### JSON.MGET

Expand Down Expand Up @@ -135,7 +133,7 @@ Delete a value.

#### Return value

[Integer][2], specifically the number of paths deleted (0 or 1).
[Integer][2], specifically the number of paths deleted (0 or more).

### JSON.NUMINCRBY

Expand Down Expand Up @@ -253,12 +251,14 @@ JSON.ARRINDEX <key> <path> <json-scalar> [start [stop]]
Search for the first occurrence of a scalar JSON value in an array.

The optional inclusive `start` (default 0) and exclusive `stop` (default 0, meaning that the last element is included) specify a slice of the array to search.
Negative values are interpreted as starting from the end.


Note: out of range errors are treated by rounding the index to the array's start and end. An inverse index range (e.g. from 1 to 0) will return unfound.

#### Return value

[Integer][2], specifically the position of the scalar value in the array, or -1 if unfound.
[Array][4], specifically, for each JSON value matching the path, the first position of the scalar value in the array, -1 if unfound in the array, or [null][6] element if the matching JSON value is not an array.

### JSON.ARRINSERT

Expand Down Expand Up @@ -474,3 +474,4 @@ Return the JSON in `key` in [Redis Serialization Protocol (RESP)][5].
[3]: http://redis.io/topics/protocol#resp-bulk-strings
[4]: http://redis.io/topics/protocol#resp-arrays
[5]: http://redis.io/topics/protocol
[6]: https://redis.io/topics/protocol#null-elements-in-arrays
9 changes: 8 additions & 1 deletion src/array_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ impl ArrayIndex for i64 {
let index = if self < 0 {
len - len.min(-self)
} else {
(len - 1).min(self)
if len > 0 {
(len - 1).min(self)
} else {
0
}
};
index as usize
}
Expand All @@ -29,5 +33,8 @@ mod tests {
assert_eq!(4.normalize(5), 4);
assert_eq!(5.normalize(5), 4);
assert_eq!(6.normalize(5), 4);
assert_eq!(0.normalize(0), 0);
assert_eq!((-1).normalize(0), 0);
assert_eq!(1.normalize(0), 0);
}
}
Loading