neo4j 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/neo4j/active_node/labels.rb +1 -1
- data/lib/neo4j/active_node/query/query_proxy_methods.rb +3 -3
- data/lib/neo4j/active_node/query_methods.rb +3 -3
- data/lib/neo4j/active_rel/query.rb +2 -2
- data/lib/neo4j/active_rel/related_node.rb +1 -1
- data/lib/neo4j/shared/identity.rb +1 -1
- data/lib/neo4j/shared/type_converters.rb +3 -3
- data/lib/neo4j/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97c01690c43625ba06268da7585cc7dc8a7f2f51
|
4
|
+
data.tar.gz: 6b8604aeb84adee416d66782605e80d7d9533700
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c6a53376027890d2e742acfacb05f4edc9f560dd1f5aa72bed72f80a8065a8c7b11ff2bef0729c2ea42e3d0deea421e06e5fcce20fe61788aec0b8e89160619
|
7
|
+
data.tar.gz: e4479499b2c48223b5f3d3f9f7c8d3da8bfb04716409cc7acfd4eb1b9781f19433aea52d3eb6cb723610fe464381200836a5ea7e47c8370b885d7bd082ac04ba
|
@@ -70,7 +70,7 @@ module Neo4j
|
|
70
70
|
end
|
71
71
|
|
72
72
|
# Returns the object with the specified neo4j id.
|
73
|
-
# @param [String,
|
73
|
+
# @param [String,Integer] id of node to find
|
74
74
|
def find(id)
|
75
75
|
map_id = proc { |object| object.respond_to?(:id) ? object.send(:id) : object }
|
76
76
|
|
@@ -16,7 +16,7 @@ module Neo4j
|
|
16
16
|
self.order(order).limit(1).pluck(target).first
|
17
17
|
end
|
18
18
|
|
19
|
-
# @return [
|
19
|
+
# @return [Integer] number of nodes of this class
|
20
20
|
def count(distinct = nil, target = nil)
|
21
21
|
fail(InvalidParameterError, ':count accepts `distinct` or nil as a parameter') unless distinct.nil? || distinct == :distinct
|
22
22
|
query_with_target(target) do |var|
|
@@ -42,7 +42,7 @@ module Neo4j
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def exists?(node_condition = nil, target = nil)
|
45
|
-
fail(InvalidParameterError, ':exists? only accepts neo_ids') unless node_condition.is_a?(
|
45
|
+
fail(InvalidParameterError, ':exists? only accepts neo_ids') unless node_condition.is_a?(Integer) || node_condition.is_a?(Hash) || node_condition.nil?
|
46
46
|
query_with_target(target) do |var|
|
47
47
|
start_q = exists_query_start(node_condition, var)
|
48
48
|
start_q.query.return("COUNT(#{var}) AS count").first.count > 0
|
@@ -144,7 +144,7 @@ module Neo4j
|
|
144
144
|
|
145
145
|
def exists_query_start(condition, target)
|
146
146
|
case condition
|
147
|
-
when
|
147
|
+
when Integer
|
148
148
|
self.where("ID(#{target}) = {exists_condition}").params(exists_condition: condition)
|
149
149
|
when Hash
|
150
150
|
self.where(condition.keys.first => condition.values.first)
|
@@ -4,7 +4,7 @@ module Neo4j
|
|
4
4
|
class InvalidParameterError < StandardError; end
|
5
5
|
|
6
6
|
def exists?(node_condition = nil)
|
7
|
-
fail(InvalidParameterError, ':exists? only accepts ids or conditions') unless node_condition.is_a?(
|
7
|
+
fail(InvalidParameterError, ':exists? only accepts ids or conditions') unless node_condition.is_a?(Integer) || node_condition.is_a?(Hash) || node_condition.nil?
|
8
8
|
query_start = exists_query_start(node_condition)
|
9
9
|
start_q = query_start.respond_to?(:query_as) ? query_start.query_as(:n) : query_start
|
10
10
|
start_q.return('COUNT(n) AS count').first.count > 0
|
@@ -20,7 +20,7 @@ module Neo4j
|
|
20
20
|
self.query_as(:n).limit(1).order(n: {primary_key => :desc}).pluck(:n).first
|
21
21
|
end
|
22
22
|
|
23
|
-
# @return [
|
23
|
+
# @return [Integer] number of nodes of this class
|
24
24
|
def count(distinct = nil)
|
25
25
|
fail(InvalidParameterError, ':count accepts `distinct` or nil as a parameter') unless distinct.nil? || distinct == :distinct
|
26
26
|
q = distinct.nil? ? 'n' : 'DISTINCT n'
|
@@ -52,7 +52,7 @@ module Neo4j
|
|
52
52
|
|
53
53
|
def exists_query_start(node_condition)
|
54
54
|
case node_condition
|
55
|
-
when
|
55
|
+
when Integer
|
56
56
|
self.query_as(:n).where('ID(n)' => node_condition)
|
57
57
|
when Hash
|
58
58
|
self.where(node_condition.keys.first => node_condition.values.first)
|
@@ -4,10 +4,10 @@ module Neo4j::ActiveRel
|
|
4
4
|
|
5
5
|
module ClassMethods
|
6
6
|
# Returns the object with the specified neo4j id.
|
7
|
-
# @param [String,
|
7
|
+
# @param [String,Integer] id of node to find
|
8
8
|
# @param [Neo4j::Session] session optional
|
9
9
|
def find(id, session = self.neo4j_session)
|
10
|
-
fail "Unknown argument #{id.class} in find method (expected String or
|
10
|
+
fail "Unknown argument #{id.class} in find method (expected String or Integer)" if !(id.is_a?(String) || id.is_a?(Integer))
|
11
11
|
find_by_id(id, session)
|
12
12
|
end
|
13
13
|
|
@@ -11,7 +11,7 @@ module Neo4j::Shared
|
|
11
11
|
persisted? ? [id] : nil
|
12
12
|
end
|
13
13
|
|
14
|
-
# @return [
|
14
|
+
# @return [Integer, nil] the neo4j id of the node if persisted or nil
|
15
15
|
def neo_id
|
16
16
|
_persisted_obj ? _persisted_obj.neo_id : nil
|
17
17
|
end
|
@@ -26,7 +26,7 @@ module Neo4j::Shared
|
|
26
26
|
DateTime
|
27
27
|
end
|
28
28
|
|
29
|
-
# Converts the given DateTime (UTC) value to an
|
29
|
+
# Converts the given DateTime (UTC) value to an Integer.
|
30
30
|
# DateTime values are automatically converted to UTC.
|
31
31
|
def to_db(value)
|
32
32
|
return nil if value.nil?
|
@@ -41,7 +41,7 @@ module Neo4j::Shared
|
|
41
41
|
def to_ruby(value)
|
42
42
|
return nil if value.nil?
|
43
43
|
t = case value
|
44
|
-
when
|
44
|
+
when Integer
|
45
45
|
Time.at(value).utc
|
46
46
|
when String
|
47
47
|
DateTime.strptime(value, '%Y-%m-%d %H:%M:%S %z')
|
@@ -60,7 +60,7 @@ module Neo4j::Shared
|
|
60
60
|
Time
|
61
61
|
end
|
62
62
|
|
63
|
-
# Converts the given DateTime (UTC) value to an
|
63
|
+
# Converts the given DateTime (UTC) value to an Integer.
|
64
64
|
# Only utc times are supported !
|
65
65
|
def to_db(value)
|
66
66
|
return nil if value.nil?
|
data/lib/neo4j/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge, Brian Underwood, Chris Grigg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: orm_adapter
|
@@ -293,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
293
293
|
version: '0'
|
294
294
|
requirements: []
|
295
295
|
rubyforge_project: neo4j
|
296
|
-
rubygems_version: 2.4.
|
296
|
+
rubygems_version: 2.4.3
|
297
297
|
signing_key:
|
298
298
|
specification_version: 4
|
299
299
|
summary: A graph database for Ruby
|