redisgraph 2.0.2 → 2.0.3
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/.github/release-drafter-config.yml +21 -0
- data/.github/workflows/release-drafter.yml +20 -0
- data/Gemfile +0 -1
- data/README.md +7 -6
- data/lib/redisgraph/connection.rb +13 -6
- data/lib/redisgraph/query_result.rb +18 -3
- data/lib/redisgraph/version.rb +1 -1
- data/lib/redisgraph.rb +0 -1
- data/redisgraph.gemspec +0 -1
- data/spec/redisgraph_spec.rb +1 -1
- metadata +5 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d49963c89e143060931e2fc7a20c73a0fe41a06f0002ec84494e6182ad28728
|
4
|
+
data.tar.gz: 90b9a339ae932fcea45bbf355518e54db7ddcad137739d5d2ad95bcb72b5bd99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4b3bc2e45a843c4328786fc1ce99e07873f9f0d09de3773ca572491867ccdc9b0f06653830167160fcf4e036349150166262890cc783e180569faecfd43bc6b
|
7
|
+
data.tar.gz: 8a0f6138c785a35ede21619c98960e3bdf96a557b98cdb3a183f1ee41ad3f99890c1e011ac6588e49efab2bcaa4f998b44cd0a44aff222155b3d0ece2b10f803
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name-template: 'Version $NEXT_PATCH_VERSION'
|
2
|
+
tag-template: 'v$NEXT_PATCH_VERSION'
|
3
|
+
categories:
|
4
|
+
- title: 'Features'
|
5
|
+
labels:
|
6
|
+
- 'feature'
|
7
|
+
- 'enhancement'
|
8
|
+
- title: 'Bug Fixes'
|
9
|
+
labels:
|
10
|
+
- 'fix'
|
11
|
+
- 'bugfix'
|
12
|
+
- 'bug'
|
13
|
+
- title: 'Maintenance'
|
14
|
+
label: 'chore'
|
15
|
+
change-template: '- $TITLE (#$NUMBER)'
|
16
|
+
exclude-labels:
|
17
|
+
- 'skip-changelog'
|
18
|
+
template: |
|
19
|
+
## Changes
|
20
|
+
|
21
|
+
$CHANGES
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Release Drafter
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
# branches to consider in the event; optional, defaults to all
|
6
|
+
branches:
|
7
|
+
- master
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
update_release_draft:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
# Drafts your next Release notes as Pull Requests are merged into "master"
|
14
|
+
- uses: release-drafter/release-drafter@v5
|
15
|
+
with:
|
16
|
+
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
|
17
|
+
config-name: release-drafter-config.yml
|
18
|
+
env:
|
19
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
20
|
+
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
[](https://circleci.com/gh/RedisGraph/redisgraph-rb/tree/master)
|
3
3
|
[](https://github.com/RedisGraph/redisgraph-rb/releases/latest)
|
4
4
|
[](https://codecov.io/gh/RedisGraph/redisgraph-rb)
|
5
|
+
[](https://badge.fury.io/rb/redisgraph)
|
5
6
|
|
6
7
|
# redisgraph-rb
|
7
8
|
[](https://forum.redislabs.com/c/modules/redisgraph)
|
8
|
-
[](https://discord.gg/gWBRT6P)
|
9
10
|
|
10
11
|
`redisgraph-rb` is a Ruby gem client for the [RedisGraph](https://github.com/RedisLabsModules/RedisGraph) module. It relies on `redis-rb` for Redis connection management and provides support for graph QUERY, EXPLAIN, and DELETE commands.
|
11
12
|
|
@@ -44,11 +45,11 @@ cmd = """MATCH ()-[:works]->(e:employer) RETURN e"""
|
|
44
45
|
response = r.query(cmd)
|
45
46
|
|
46
47
|
response.print_resultset
|
47
|
-
|
48
|
-
| e
|
49
|
-
|
50
|
-
| Dunder Mifflin |
|
51
|
-
|
48
|
+
--------------------------------
|
49
|
+
| e |
|
50
|
+
--------------------------------
|
51
|
+
| [{"name"=>"Dunder Mifflin"}] |
|
52
|
+
--------------------------------
|
52
53
|
|
53
54
|
r.delete
|
54
55
|
=> "Graph removed, internal execution time: 0.416024 milliseconds"
|
@@ -1,19 +1,26 @@
|
|
1
1
|
class RedisGraph
|
2
2
|
def connect_to_server(options)
|
3
3
|
@connection = Redis.new(options)
|
4
|
-
|
5
|
-
raise ServerError, "RedisGraph module not loaded." if @module_version.nil?
|
6
|
-
raise ServerError, "RedisGraph module incompatible, expecting >= 1.99." if @module_version < 19900
|
4
|
+
check_module_version
|
7
5
|
end
|
8
6
|
|
9
7
|
# Ensure that the connected Redis server supports modules
|
10
8
|
# and has loaded the RedisGraph module
|
11
|
-
def
|
9
|
+
def check_module_version()
|
12
10
|
redis_version = @connection.info["redis_version"]
|
13
11
|
major_version = redis_version.split('.').first.to_i
|
14
12
|
raise ServerError, "Redis 4.0 or greater required for RedisGraph support." unless major_version >= 4
|
15
|
-
|
13
|
+
|
14
|
+
begin
|
15
|
+
modules = @connection.call("MODULE", "LIST")
|
16
|
+
rescue Redis::CommandError
|
17
|
+
# Ignore check if the connected server does not support the "MODULE LIST" command
|
18
|
+
return
|
19
|
+
end
|
20
|
+
|
16
21
|
module_graph = modules.detect { |_name_key, name, _ver_key, _ver| name == 'graph' }
|
17
|
-
module_graph[3] if module_graph
|
22
|
+
module_version = module_graph[3] if module_graph
|
23
|
+
raise ServerError, "RedisGraph module not loaded." if module_version.nil?
|
24
|
+
raise ServerError, "RedisGraph module incompatible, expecting >= 1.99." if module_version < 19900
|
18
25
|
end
|
19
26
|
end
|
@@ -39,10 +39,25 @@ class QueryResult
|
|
39
39
|
def print_resultset
|
40
40
|
return unless columns
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
# Compute max length of each column
|
43
|
+
column_sizes = resultset.reduce([]) do |lengths, row|
|
44
|
+
row.each_with_index.map{|iterand, index| [lengths[index] || 0, iterand.to_s.length].max}
|
44
45
|
end
|
45
|
-
|
46
|
+
|
47
|
+
# Print column headers
|
48
|
+
puts head = '-' * (column_sizes.inject(&:+) + (3 * column_sizes.count) + 1)
|
49
|
+
row = columns.fill(nil, columns.size..(column_sizes.size - 1))
|
50
|
+
row = row.each_with_index.map{|v, i| v = v.to_s + ' ' * (column_sizes[i] - v.to_s.length)}
|
51
|
+
puts '| ' + row.join(' | ') + ' |'
|
52
|
+
puts head
|
53
|
+
|
54
|
+
# Print result set rows
|
55
|
+
resultset.each do |row|
|
56
|
+
row = row.fill(nil, row.size..(column_sizes.size - 1))
|
57
|
+
row = row.each_with_index.map{|v, i| v = v.to_s + ' ' * (column_sizes[i] - v.to_s.length)}
|
58
|
+
puts '| ' + row.join(' | ') + ' |'
|
59
|
+
end
|
60
|
+
puts head
|
46
61
|
end
|
47
62
|
|
48
63
|
def parse_resultset(response)
|
data/lib/redisgraph/version.rb
CHANGED
data/lib/redisgraph.rb
CHANGED
data/redisgraph.gemspec
CHANGED
data/spec/redisgraph_spec.rb
CHANGED
@@ -89,7 +89,7 @@ describe RedisGraph do
|
|
89
89
|
it "should print property strings correctly after updates" do
|
90
90
|
q = """MATCH (a {name: 'src1'}) RETURN a"""
|
91
91
|
res = @r.query(q)
|
92
|
-
expect(res.resultset).to eq([[[{"name"=>"src1"}, {"color"=>"cyan"}, {"newval"=>
|
92
|
+
expect(res.resultset).to eq([[[{"name"=>"src1"}, {"color"=>"cyan"}, {"newval"=>true}]]])
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redisgraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Redis Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -24,26 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: terminal-table
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1'
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '1.8'
|
37
|
-
type: :runtime
|
38
|
-
prerelease: false
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - "~>"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '1'
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '1.8'
|
47
27
|
description: A client that extends redis-rb to provide explicit support for the RedisGraph
|
48
28
|
module.
|
49
29
|
email: jeffrey@redislabs.com
|
@@ -52,6 +32,8 @@ extensions: []
|
|
52
32
|
extra_rdoc_files: []
|
53
33
|
files:
|
54
34
|
- ".circleci/config.yml"
|
35
|
+
- ".github/release-drafter-config.yml"
|
36
|
+
- ".github/workflows/release-drafter.yml"
|
55
37
|
- ".gitignore"
|
56
38
|
- Gemfile
|
57
39
|
- LICENSE
|
@@ -84,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
66
|
- !ruby/object:Gem::Version
|
85
67
|
version: '0'
|
86
68
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
69
|
+
rubygems_version: 3.2.22
|
88
70
|
signing_key:
|
89
71
|
specification_version: 4
|
90
72
|
summary: A client for RedisGraph
|