redis-json 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/redis/json/client.rb +13 -4
- data/lib/redis/json/commands_patch.rb +10 -2
- data/lib/redis/json/version.rb +1 -1
- data/sig/lib/redis/json/client.rbs +57 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f21dfc2993ab2cb612487b693250acd7b6b6abbe7383750034493293cac4d31
|
4
|
+
data.tar.gz: c4c954ed2dba4b22c2bd33f7a7ccb861c465ba387aa2ca29db1ae62d6f516bd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e52b5e03f9662cb0fdb05f5fa751a3022bd7b76cb816d2aa317ecc54a505868f63bad7edf15c0968ae8aa2ca848d95c01196250218b9a95d05567480007d5740
|
7
|
+
data.tar.gz: 75fef9d0d2fbb4c6fdfb14458c3e0f7f9e149e19c0ac870b739d6652c42849cf7cd5418377ce5a4e5bad60acdc91e52753225266f0e35c57bff99390857a3c22
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.0.2 2023-06-06
|
4
|
+
|
5
|
+
### Bug fixes
|
6
|
+
|
7
|
+
- Added check to allow compatibility with versions of redis-rb earlier than 4.6.0
|
8
|
+
|
9
|
+
## 1.0.1 2023-06-06
|
10
|
+
|
11
|
+
### New features
|
12
|
+
|
13
|
+
- Added type signatures for json client methods.
|
14
|
+
|
15
|
+
### Bug fixes
|
16
|
+
|
17
|
+
- Added missing parsing to return value of `arrpop`.
|
18
|
+
|
3
19
|
## 1.0.0 2023-06-05
|
4
20
|
|
5
21
|
First release. Refer to [README.md](README.md) for the full documentation.
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ hash = {
|
|
34
34
|
string: 'example',
|
35
35
|
empty_object: {}
|
36
36
|
}
|
37
|
-
redis.json.set 'key', hash # => OK
|
37
|
+
redis.json.set 'key', hash, path: '$' # => OK
|
38
38
|
```
|
39
39
|
|
40
40
|
Input values will be converted to JSON strings using `JSON.generate`, and returned JSON strings will be parsed to Ruby objects using `JSON.parse`. You can use, respectively, `generate_options` and `parse_options` to specify options that will be passed on to the `JSON` methods:
|
data/lib/redis/json/client.rb
CHANGED
@@ -52,18 +52,27 @@ class Redis
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
def arrpop key, index=NOT_PROVIDED, path: NOT_PROVIDED
|
55
|
+
def arrpop key, index=NOT_PROVIDED, path: NOT_PROVIDED, parse_options: {}
|
56
56
|
if !index.eql?(NOT_PROVIDED) && path.eql?(NOT_PROVIDED)
|
57
57
|
raise ArgumentError,
|
58
58
|
'You cannot specify an index unless you also specify a path'
|
59
59
|
end
|
60
60
|
|
61
61
|
if path.eql? NOT_PROVIDED
|
62
|
-
call
|
62
|
+
call(__callee__, key)
|
63
|
+
.then do |response|
|
64
|
+
parse response, **parse_options if response
|
65
|
+
end
|
63
66
|
elsif index.eql? NOT_PROVIDED
|
64
|
-
call
|
67
|
+
call(__callee__, key, path)
|
68
|
+
.map do |response|
|
69
|
+
parse response, **parse_options if response
|
70
|
+
end
|
65
71
|
else
|
66
|
-
call
|
72
|
+
call(__callee__, key, path, index)
|
73
|
+
.map do |response|
|
74
|
+
parse response, **parse_options if response
|
75
|
+
end
|
67
76
|
end
|
68
77
|
end
|
69
78
|
|
data/lib/redis/json/version.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
class Redis
|
2
|
+
module JSON
|
3
|
+
class Client
|
4
|
+
def call: (Symbol command, *String args) -> untyped
|
5
|
+
|
6
|
+
def arrappend: (String key, Hash[untyped, untyped] value, *Hash[untyped, untyped] values, ?path: String, ?generate_options: ::Hash[Symbol, untyped]) -> untyped
|
7
|
+
|
8
|
+
def arrindex: (String key, Hash[untyped, untyped] value, ?Integer start, ?Integer stop, path: String, ?generate_options: ::Hash[Symbol, untyped]) -> untyped
|
9
|
+
|
10
|
+
def arrinsert: (String key, untyped index, Hash[untyped, untyped] value, *Hash[untyped, untyped] values, path: String, ?generate_options: ::Hash[Symbol, untyped]) -> untyped
|
11
|
+
|
12
|
+
def arrlen: (String key, ?path: String) -> untyped
|
13
|
+
|
14
|
+
def arrpop: (String key, ?Integer index, ?path: String) -> untyped
|
15
|
+
|
16
|
+
def arrtrim: (String key, Integer start, Integer stop, path: String) -> untyped
|
17
|
+
|
18
|
+
def clear: (String key, ?path: String) -> untyped
|
19
|
+
|
20
|
+
def debug_memory: (String key, ?path: String) -> untyped
|
21
|
+
|
22
|
+
def del: (String key, ?path: String) -> untyped
|
23
|
+
|
24
|
+
def forget: (String key, ?path: String) -> untyped
|
25
|
+
|
26
|
+
def get: (String key, *String paths, ?indent: String, ?newline: String, ?space: String, ?parse_options: ::Hash[Symbol, untyped]) -> untyped
|
27
|
+
|
28
|
+
def merge: (String key, Hash[untyped, untyped] value, path: String, ?generate_options: ::Hash[Symbol, untyped]) -> untyped
|
29
|
+
|
30
|
+
def mget: (String key, *String keys, path: String, ?parse_options: ::Hash[Symbol, untyped]) -> untyped
|
31
|
+
|
32
|
+
def mset: (String key, untyped path, Hash[untyped, untyped] value, *untyped rest, ?generate_options: ::Hash[Symbol, untyped]) -> untyped
|
33
|
+
|
34
|
+
def numincrby: (String key, Hash[untyped, untyped] value, path: String, ?parse_options: ::Hash[Symbol, untyped]) -> untyped
|
35
|
+
|
36
|
+
def nummultby: (String key, Hash[untyped, untyped] value, path: String, ?parse_options: ::Hash[Symbol, untyped]) -> untyped
|
37
|
+
|
38
|
+
def numpowby: (String key, Hash[untyped, untyped] value, path: String, ?parse_options: ::Hash[Symbol, untyped]) -> untyped
|
39
|
+
|
40
|
+
def objkeys: (String key, ?path: String) -> untyped
|
41
|
+
|
42
|
+
def objlen: (String key, ?path: String) -> untyped
|
43
|
+
|
44
|
+
def resp: (String key, ?path: String) -> untyped
|
45
|
+
|
46
|
+
def set: (String key, Hash[untyped, untyped] value, path: String, ?nx: bool, ?xx: bool, ?generate_options: ::Hash[Symbol, untyped]) -> untyped
|
47
|
+
|
48
|
+
def strappend: (String key, Hash[untyped, untyped] value, ?path: String, ?generate_options: ::Hash[Symbol, untyped]) -> untyped
|
49
|
+
|
50
|
+
def strlen: (String key, ?path: String) -> untyped
|
51
|
+
|
52
|
+
def toggle: (String key, path: String) -> untyped
|
53
|
+
|
54
|
+
def type: (String key, ?path: String) -> untyped
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moku S.r.l.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-06-
|
12
|
+
date: 2023-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/redis/json/client.rb
|
43
43
|
- lib/redis/json/commands_patch.rb
|
44
44
|
- lib/redis/json/version.rb
|
45
|
+
- sig/lib/redis/json/client.rbs
|
45
46
|
homepage: https://github.com/moku-io/redis-json
|
46
47
|
licenses:
|
47
48
|
- MIT
|