Skip to content

Commit 1109adb

Browse files
Add backwards compatibility with RedisGraph v2.0.x (#10)
1 parent f39129c commit 1109adb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/redisgraph/query_result.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ def parse_resultset(response)
6464
header.reduce([]) do |agg, (type, _it)|
6565
i += 1
6666
el = row[i]
67-
agg << map_scalar(el[0], el[1])
67+
case type
68+
when 1 # Column of scalars
69+
agg << map_scalar(el[0], el[1])
70+
when 2 # node
71+
props = el[2]
72+
agg << props.sort_by { |prop| prop[0] }.map { |prop| map_prop(prop) }
73+
when 3 # Column of relations
74+
props = el[4]
75+
agg << props.sort_by { |prop| prop[0] }.map { |prop| map_prop(prop) }
76+
end
6877
end
6978
end
7079

0 commit comments

Comments
 (0)