redis-json 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c4992d626b03ba86229fb96d18713a5ae0154e566c60a4740444c9dfa42a8e7
4
- data.tar.gz: 005bbd5b6e66ddf75e83a585251099d07ad8a3cb9b00b15b0f6ba12973c6e475
3
+ metadata.gz: f62b79d920fff44b30233d3d9723fe413dfd316f9cb94fd7f0cde4602a6f9e30
4
+ data.tar.gz: a5e6c5603730c4f863ef60b066776f7a9820bc9f460b1fdcdda5f0eefaa39195
5
5
  SHA512:
6
- metadata.gz: 54a918c7cf3a6e85025f1f2fa168c17dcfac7b0e2bc931c08f4288614b7836773eb6c02f14493333fd757f3c2910029889cdc063a6629b6404c0e245f6ca18da
7
- data.tar.gz: 71deaea8c939d271c9d30453886af0fe314ae3c91dd1068a0f60f898a463877a6398eba38d1bff1b128d05f3245d1967e22d40e3e8d710c6e27f293a40e63aef
6
+ metadata.gz: 4e02f20f232fe10431536b216d1dc8c560163be952b9900e605f0a14bcf22a2d2e39aee4bb577e1d459b5f679d32ead3a28a1d863afc5f5119111e82f80b1981
7
+ data.tar.gz: e203b86be101dfef7ec5b57dba5b34b981b794167742f0f8c1440f898f66ce39042d31112f97c34f79a6fde3124f4c5e84af8b6a7f3e6ec6d61c344dc1d694d7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.1 2023-06-06
4
+
5
+ ### New features
6
+
7
+ - Added type signatures for json client methods.
8
+
9
+ ### Bug fixes
10
+
11
+ - Added missing parsing to return value of `arrpop`.
12
+
3
13
  ## 1.0.0 2023-06-05
4
14
 
5
15
  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:
@@ -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 __callee__, key
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 __callee__, key, path
67
+ call(__callee__, key, path)
68
+ .map do |response|
69
+ parse response, **parse_options if response
70
+ end
65
71
  else
66
- call __callee__, key, path, index
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
 
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  module JSON
3
- VERSION = '1.0.0'.freeze
3
+ VERSION = '1.0.1'.freeze
4
4
  end
5
5
  end
@@ -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.0
4
+ version: 1.0.1
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-05 00:00:00.000000000 Z
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