neo4j-ruby-driver 6.2.1.beta.1-java → 6.2.1.beta.2-java
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/lib/neo4j/driver/exceptions/no_such_record_exception.rb +1 -1
- data/lib/neo4j/driver/ext/bookmark_managers.rb +2 -1
- data/lib/neo4j/driver/ext/config_converter.rb +4 -3
- data/lib/neo4j/driver/ext/exception_checkable.rb +3 -3
- data/lib/neo4j/driver/ext/exception_mapper.rb +0 -4
- data/lib/neo4j/driver/ext/internal/driver_factory.rb +1 -1
- data/lib/neo4j/driver/ext/internal/internal_notification_severity.rb +1 -0
- data/lib/neo4j/driver/ext/internal/summary/internal_result_summary.rb +3 -3
- data/lib/neo4j/driver/ext/internal_driver.rb +2 -1
- data/lib/neo4j/driver/ext/internal_result.rb +2 -2
- data/lib/neo4j/driver/ext/internal_session.rb +5 -1
- data/lib/neo4j/driver/ext/logger.rb +7 -6
- data/lib/neo4j/driver/ext/neo_converter.rb +4 -5
- data/lib/neo4j/driver/ext/ruby_converter.rb +1 -1
- data/lib/neo4j/driver/internal/duration_normalizer.rb +4 -2
- data/lib/neo4j/driver/internal/validator.rb +7 -3
- data/lib/neo4j/driver/types/duration.rb +6 -6
- data/lib/neo4j/driver/types/local_date_time.rb +46 -21
- data/lib/neo4j/driver/types/local_time.rb +13 -5
- data/lib/neo4j/driver/types/offset_time.rb +16 -9
- data/lib/neo4j/driver/types/point.rb +4 -4
- data/lib/neo4j/driver/types/temporal_value.rb +3 -2
- data/lib/neo4j/driver/version.rb +1 -1
- data/lib/neo4j/driver.rb +1 -1
- metadata +3 -72
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8c23247c73132c7a801d9c4236df0e5ec06f7f89ca62e6a4bb5b5613a9ba0ca9
|
|
4
|
+
data.tar.gz: ad8bff687e3c0429cc26cc4c3663a7fcceb63f9c32c362dcb9a2cc968d416b38
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e13cba51cf61aa2cf912d6cbf404acd8cd016e7d26aafbb50b89b988d30611e5e6b33ce22d1f786350389dc53730db535c92dc66fe94110e1a9dc7e892814094
|
|
7
|
+
data.tar.gz: 293189542dd4e549f20aaf0641734d677f94b12b6e323a07912e0c4d3caf08fa4d4706431b50a9e696ce3abbfc00ba7843e1f6499739760a00c2534fbc20ebcd
|
|
@@ -6,7 +6,7 @@ module Neo4j
|
|
|
6
6
|
class NoSuchRecordException < RuntimeError
|
|
7
7
|
EMPTY = 'Cannot retrieve a single record, because this result is empty.'
|
|
8
8
|
TOO_MANY = 'Expected a result with a single record, but this result ' \
|
|
9
|
-
|
|
9
|
+
'contains at least one more. Ensure your query returns only one record.'
|
|
10
10
|
NO_MORE = 'No more records'
|
|
11
11
|
NO_PEEK_PAST = 'Cannot peek past the last record'
|
|
12
12
|
|
|
@@ -12,7 +12,8 @@ module Neo4j
|
|
|
12
12
|
include ConfigConverter
|
|
13
13
|
|
|
14
14
|
def default_manager(initial_bookmarks: nil, bookmarks_supplier: nil, bookmarks_consumer: nil)
|
|
15
|
-
super(to_java_config(Neo4j::Driver::BookmarkManagerConfig, initial_bookmarks:, bookmarks_supplier:,
|
|
15
|
+
super(to_java_config(Neo4j::Driver::BookmarkManagerConfig, initial_bookmarks:, bookmarks_supplier:,
|
|
16
|
+
bookmarks_consumer:))
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
19
|
end
|
|
@@ -50,7 +50,7 @@ module Neo4j
|
|
|
50
50
|
value = ->(address) { to_java_set(proc.call(address), java.util.LinkedHashSet) }
|
|
51
51
|
when 'bookmarks_supplier'
|
|
52
52
|
proc = value
|
|
53
|
-
value = ->
|
|
53
|
+
value = -> { to_java_set(proc.call) }
|
|
54
54
|
when 'bookmarks_consumer'
|
|
55
55
|
proc = value
|
|
56
56
|
value = ->(bookmarks) { proc.call(Set.new(bookmarks)) }
|
|
@@ -85,7 +85,7 @@ module Neo4j
|
|
|
85
85
|
case strategy
|
|
86
86
|
when :trust_custom_certificates
|
|
87
87
|
Config::TrustStrategy
|
|
88
|
-
|
|
88
|
+
.trust_custom_certificate_signed_by(*config.delete(:cert_files).map(&java.io.File.method(:new)))
|
|
89
89
|
else
|
|
90
90
|
Config::TrustStrategy.send(strategy)
|
|
91
91
|
end
|
|
@@ -97,7 +97,8 @@ module Neo4j
|
|
|
97
97
|
value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity).or_else(nil),
|
|
98
98
|
disabled_categories
|
|
99
99
|
&.map { |value| value_of(org.neo4j.driver.NotificationClassification, value) }
|
|
100
|
-
&.then(&method(:to_java_set))
|
|
100
|
+
&.then(&method(:to_java_set))
|
|
101
|
+
)
|
|
101
102
|
end
|
|
102
103
|
|
|
103
104
|
def value_of(klass, value)
|
|
@@ -17,9 +17,9 @@ module Neo4j
|
|
|
17
17
|
rescue Neo4j::Driver::Exceptions::ServiceUnavailableException => e
|
|
18
18
|
raise(throwable(e.cause) || Java::OrgNeo4jDriverExceptions::ServiceUnavailableException.new(e.message))
|
|
19
19
|
rescue Neo4j::Driver::Exceptions::Neo4jException,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
Neo4j::Driver::Exceptions::NoSuchRecordException,
|
|
21
|
+
Neo4j::Driver::Exceptions::UntrustedServerException,
|
|
22
|
+
Neo4j::Driver::Exceptions::IllegalStateException => e
|
|
23
23
|
raise(throwable(e.cause) || e)
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -152,8 +152,6 @@ module Neo4j
|
|
|
152
152
|
Neo4j::Driver::Exceptions::TransientException
|
|
153
153
|
when Neo4jException # base — catches plain GQL-cause exceptions (must be last)
|
|
154
154
|
Neo4j::Driver::Exceptions::Neo4jException
|
|
155
|
-
else
|
|
156
|
-
nil
|
|
157
155
|
end
|
|
158
156
|
end
|
|
159
157
|
|
|
@@ -167,8 +165,6 @@ module Neo4j
|
|
|
167
165
|
Neo4j::Driver::Exceptions::IllegalStateException
|
|
168
166
|
when Java::JavaLang::IllegalArgumentException
|
|
169
167
|
ArgumentError
|
|
170
|
-
else
|
|
171
|
-
nil
|
|
172
168
|
end
|
|
173
169
|
end
|
|
174
170
|
end
|
|
@@ -26,7 +26,7 @@ module Neo4j
|
|
|
26
26
|
def to_domain_name_resolver(resolver_proc)
|
|
27
27
|
return nil unless resolver_proc
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
lambda do |name|
|
|
30
30
|
resolver_proc.call(name).map do |addr|
|
|
31
31
|
java.net.InetAddress.get_by_name(addr)
|
|
32
32
|
rescue java.net.UnknownHostException => e
|
|
@@ -30,9 +30,9 @@ module Neo4j
|
|
|
30
30
|
# would be to disambiguate this one method.
|
|
31
31
|
def query_type
|
|
32
32
|
case super
|
|
33
|
-
when Java::OrgNeo4jDriverSummary::QueryType::READ_ONLY
|
|
34
|
-
when Java::OrgNeo4jDriverSummary::QueryType::READ_WRITE
|
|
35
|
-
when Java::OrgNeo4jDriverSummary::QueryType::WRITE_ONLY
|
|
33
|
+
when Java::OrgNeo4jDriverSummary::QueryType::READ_ONLY then Driver::Summary::QueryType::READ_ONLY
|
|
34
|
+
when Java::OrgNeo4jDriverSummary::QueryType::READ_WRITE then Driver::Summary::QueryType::READ_WRITE
|
|
35
|
+
when Java::OrgNeo4jDriverSummary::QueryType::WRITE_ONLY then Driver::Summary::QueryType::WRITE_ONLY
|
|
36
36
|
when Java::OrgNeo4jDriverSummary::QueryType::SCHEMA_WRITE then Driver::Summary::QueryType::SCHEMA_WRITE
|
|
37
37
|
end
|
|
38
38
|
end
|
|
@@ -88,7 +88,8 @@ module Neo4j
|
|
|
88
88
|
source = Internal::Reflection.field(session_factory, 'connectionSource')
|
|
89
89
|
until Internal::Reflection.field?(source, 'registry')
|
|
90
90
|
unless Internal::Reflection.field?(source, 'delegate')
|
|
91
|
-
raise KeyError,
|
|
91
|
+
raise KeyError,
|
|
92
|
+
"No routing-table registry in the connection-source chain (#{source.java_class.simple_name})"
|
|
92
93
|
end
|
|
93
94
|
|
|
94
95
|
source = Internal::Reflection.field(source, 'delegate')
|
|
@@ -17,7 +17,11 @@ module Neo4j
|
|
|
17
17
|
%i[read write].each do |mode|
|
|
18
18
|
define_method("execute_#{mode}") do |**config, &block|
|
|
19
19
|
check do
|
|
20
|
-
super(
|
|
20
|
+
super(lambda { |tx|
|
|
21
|
+
Struct::Wrapper.new(reverse_check do
|
|
22
|
+
block.call(tx)
|
|
23
|
+
end)
|
|
24
|
+
}, to_java_config(Neo4j::Driver::TransactionConfig, **config)).object
|
|
21
25
|
end
|
|
22
26
|
end
|
|
23
27
|
end
|
|
@@ -19,13 +19,13 @@ module Neo4j
|
|
|
19
19
|
end
|
|
20
20
|
alias get_log getLog
|
|
21
21
|
|
|
22
|
-
def error(*
|
|
22
|
+
def error(*) = log(::Logger::ERROR, *)
|
|
23
23
|
|
|
24
|
-
def info(*
|
|
24
|
+
def info(*) = log(::Logger::INFO, *)
|
|
25
25
|
|
|
26
|
-
def warn(*
|
|
26
|
+
def warn(*) = log(::Logger::WARN, *)
|
|
27
27
|
|
|
28
|
-
def debug(*
|
|
28
|
+
def debug(*) = log(::Logger::DEBUG, *)
|
|
29
29
|
alias trace debug
|
|
30
30
|
|
|
31
31
|
def trace_enabled?
|
|
@@ -38,12 +38,13 @@ module Neo4j
|
|
|
38
38
|
|
|
39
39
|
private
|
|
40
40
|
|
|
41
|
-
def log(level, *
|
|
42
|
-
@logger.add(level) { format(*
|
|
41
|
+
def log(level, *)
|
|
42
|
+
@logger.add(level) { format(*) }
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def format(message, *args)
|
|
46
46
|
return message.to_s if args.empty? && !message.is_a?(java.lang.Throwable)
|
|
47
|
+
|
|
47
48
|
args.unshift(message)
|
|
48
49
|
args.unshift('%s%n%s') if args.last.is_a?(java.lang.Throwable)
|
|
49
50
|
java.lang.String.format(*args)
|
|
@@ -42,11 +42,10 @@ module Neo4j
|
|
|
42
42
|
when nil, true, false, Integer, Float
|
|
43
43
|
object
|
|
44
44
|
else
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
end
|
|
45
|
+
raise Exceptions::ClientException.unable_to_convert(object) unless skip_unknown
|
|
46
|
+
|
|
47
|
+
object
|
|
48
|
+
|
|
50
49
|
end
|
|
51
50
|
end
|
|
52
51
|
|
|
@@ -14,8 +14,10 @@ module Neo4j
|
|
|
14
14
|
# Check the sign before rounding: a tiny negative timeout
|
|
15
15
|
# (e.g. -0.4ms) would otherwise round to 0 and slip through.
|
|
16
16
|
ms = timeout.to_f * 1000
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
if ms.negative?
|
|
18
|
+
raise Exceptions::ClientException,
|
|
19
|
+
"Transaction timeout must not be negative, but was #{ms}ms"
|
|
20
|
+
end
|
|
19
21
|
|
|
20
22
|
ms.round
|
|
21
23
|
end
|
|
@@ -16,6 +16,7 @@ module Neo4j
|
|
|
16
16
|
|
|
17
17
|
def self.require_non_nil!(obj, message = nil)
|
|
18
18
|
raise ArgumentError, [message, "can't be nil"].compact.join(' ') if obj.nil?
|
|
19
|
+
|
|
19
20
|
obj
|
|
20
21
|
end
|
|
21
22
|
|
|
@@ -24,14 +25,17 @@ module Neo4j
|
|
|
24
25
|
# object carries its own text, so only bare strings are checked.
|
|
25
26
|
def self.require_query_text!(query)
|
|
26
27
|
raise ArgumentError, 'Cypher query text should not be null' if query.nil?
|
|
27
|
-
|
|
28
|
+
if query.is_a?(String) && query.strip.empty?
|
|
29
|
+
raise ArgumentError,
|
|
30
|
+
'Cypher query text should not be an empty string'
|
|
31
|
+
end
|
|
28
32
|
|
|
29
33
|
query
|
|
30
34
|
end
|
|
31
35
|
|
|
32
36
|
def self.require_non_nil_credentials!(username, password)
|
|
33
|
-
require_non_nil! username,
|
|
34
|
-
require_non_nil! password,
|
|
37
|
+
require_non_nil! username, 'Username'
|
|
38
|
+
require_non_nil! password, 'Password'
|
|
35
39
|
end
|
|
36
40
|
end
|
|
37
41
|
end
|
|
@@ -25,12 +25,12 @@ module Neo4j
|
|
|
25
25
|
raise ArgumentError, "Invalid ISO 8601 duration format: #{string}"
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
years = (
|
|
29
|
-
months = (
|
|
30
|
-
days = (
|
|
31
|
-
hours = (
|
|
32
|
-
minutes = (
|
|
33
|
-
seconds_with_fraction = (
|
|
28
|
+
years = (::Regexp.last_match(1) || 0).to_i
|
|
29
|
+
months = (::Regexp.last_match(2) || 0).to_i
|
|
30
|
+
days = (::Regexp.last_match(3) || 0).to_i
|
|
31
|
+
hours = (::Regexp.last_match(4) || 0).to_i
|
|
32
|
+
minutes = (::Regexp.last_match(5) || 0).to_i
|
|
33
|
+
seconds_with_fraction = (::Regexp.last_match(6) || 0).to_f
|
|
34
34
|
|
|
35
35
|
total_months = years * 12 + months
|
|
36
36
|
whole_seconds = seconds_with_fraction.to_i
|
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
module Neo4j
|
|
4
4
|
module Driver
|
|
5
5
|
module Types
|
|
6
|
-
# Bolt LocalDateTime — wall-clock datetime
|
|
7
|
-
# Stored as the wire-format pair
|
|
8
|
-
# epoch_seconds
|
|
9
|
-
# UTC
|
|
10
|
-
#
|
|
6
|
+
# Bolt LocalDateTime — a wall-clock datetime with no timezone
|
|
7
|
+
# (java.time.LocalDateTime). Stored as the wire-format pair
|
|
8
|
+
# (epoch_seconds, nanoseconds), where epoch_seconds encodes the
|
|
9
|
+
# wall-clock components as if they were UTC — so the value reads the
|
|
10
|
+
# same regardless of the host TZ.
|
|
11
|
+
#
|
|
12
|
+
# There is deliberately no #to_time: a zone-less value cannot become a
|
|
13
|
+
# zoned Ruby Time without inventing a zone, and every serious datetime
|
|
14
|
+
# library refuses that implicit conversion (Java's LocalDateTime forces
|
|
15
|
+
# .atZone/.atOffset; Python yields a naive datetime). Read the fields via
|
|
16
|
+
# the component getters instead.
|
|
11
17
|
class LocalDateTime < TemporalValue
|
|
12
18
|
PARSE_FORMATS = [
|
|
13
19
|
'%Y-%m-%d %H:%M:%S.%N',
|
|
@@ -28,35 +34,54 @@ module Neo4j
|
|
|
28
34
|
|
|
29
35
|
def self.from_epoch(epoch_seconds, nanoseconds) = new(epoch_seconds, nanoseconds)
|
|
30
36
|
|
|
37
|
+
# Store the Time's wall clock (its date and time-of-day *in its own
|
|
38
|
+
# zone*), dropping the zone. We read that wall clock off the instant
|
|
39
|
+
# using the offset the Time already carries — we never invent a zone,
|
|
40
|
+
# so from_time(t) and from_time(t.utc) differ (they show different
|
|
41
|
+
# clocks). epoch_seconds encodes it as-if-UTC per the class contract.
|
|
31
42
|
def self.from_time(time)
|
|
32
|
-
new(time.to_i
|
|
43
|
+
new(time.to_i + time.utc_offset, time.nsec)
|
|
33
44
|
end
|
|
34
45
|
|
|
35
46
|
def self.parse(string)
|
|
36
47
|
# Strip trailing timezone if present — naive datetime ignores it.
|
|
37
|
-
naive = string.sub(/[Z
|
|
38
|
-
time = PARSE_FORMATS.lazy.filter_map
|
|
48
|
+
naive = string.sub(/[Z+-]\d{2}:?\d{2}?$/, '')
|
|
49
|
+
time = PARSE_FORMATS.lazy.filter_map do |fmt|
|
|
50
|
+
::Time.strptime(naive, fmt)
|
|
51
|
+
rescue StandardError
|
|
52
|
+
nil
|
|
53
|
+
end.first
|
|
39
54
|
raise ArgumentError, "Invalid LocalDateTime format: #{string}" unless time
|
|
40
|
-
from_time(::Time.utc(*time_components(time)))
|
|
41
|
-
end
|
|
42
55
|
|
|
43
|
-
|
|
44
|
-
[time.year, time.month, time.day, time.hour, time.min, time.sec, time.subsec * 1_000_000]
|
|
56
|
+
from_time(time)
|
|
45
57
|
end
|
|
46
|
-
private_class_method :time_components
|
|
47
58
|
|
|
48
|
-
def
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
def year = wall_clock.year
|
|
60
|
+
def month = wall_clock.month
|
|
61
|
+
def day = wall_clock.day
|
|
62
|
+
def hour = wall_clock.hour
|
|
63
|
+
def minute = wall_clock.min
|
|
64
|
+
def second = wall_clock.sec
|
|
65
|
+
def nanosecond = @nanoseconds
|
|
51
66
|
|
|
52
|
-
# Add a numeric or ActiveSupport::Duration.
|
|
53
|
-
#
|
|
54
|
-
def +(
|
|
55
|
-
|
|
67
|
+
# Add a numeric or ActiveSupport::Duration. A wall clock has no DST,
|
|
68
|
+
# so this is plain second arithmetic; sub-second precision preserved.
|
|
69
|
+
def +(other)
|
|
70
|
+
total = (@epoch_seconds * NANOS_PER_SECOND) + @nanoseconds +
|
|
71
|
+
(other.to_f * NANOS_PER_SECOND).round
|
|
72
|
+
self.class.new(total / NANOS_PER_SECOND, total % NANOS_PER_SECOND)
|
|
56
73
|
end
|
|
57
74
|
|
|
58
75
|
def to_s
|
|
59
|
-
|
|
76
|
+
wall_clock.strftime('%Y-%m-%d %H:%M:%S.%N')
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
private
|
|
80
|
+
|
|
81
|
+
# epoch_seconds read back as its wall clock. UTC by construction, so
|
|
82
|
+
# the components never depend on the host TZ.
|
|
83
|
+
def wall_clock
|
|
84
|
+
::Time.at(@epoch_seconds, @nanoseconds.to_i, :nanosecond, in: 'UTC')
|
|
60
85
|
end
|
|
61
86
|
end
|
|
62
87
|
end
|
|
@@ -16,6 +16,14 @@ module Neo4j
|
|
|
16
16
|
|
|
17
17
|
def self.from_nanos(nanoseconds) = new(nanoseconds)
|
|
18
18
|
|
|
19
|
+
# Build from a Ruby Time, taking its displayed wall clock (so the
|
|
20
|
+
# host zone / .utc of the Time decides which time-of-day is captured).
|
|
21
|
+
# Mirrors LocalDateTime.from_time.
|
|
22
|
+
def self.from_time(time)
|
|
23
|
+
new(time.hour * NANOS_PER_HOUR + time.min * NANOS_PER_MINUTE +
|
|
24
|
+
time.sec * NANOS_PER_SECOND + time.nsec)
|
|
25
|
+
end
|
|
26
|
+
|
|
19
27
|
# Accepts "12:34:56.123456789" or any string containing such a
|
|
20
28
|
# time component (so a full datetime works too — we just take the
|
|
21
29
|
# time fields).
|
|
@@ -34,15 +42,15 @@ module Neo4j
|
|
|
34
42
|
end
|
|
35
43
|
private_class_method :parse_nanos
|
|
36
44
|
|
|
37
|
-
def hour
|
|
38
|
-
def minute
|
|
39
|
-
def second
|
|
45
|
+
def hour = (@nanoseconds / NANOS_PER_HOUR) % 24
|
|
46
|
+
def minute = (@nanoseconds / NANOS_PER_MINUTE) % 60
|
|
47
|
+
def second = (@nanoseconds / NANOS_PER_SECOND) % 60
|
|
40
48
|
def nanosecond = @nanoseconds % NANOS_PER_SECOND
|
|
41
49
|
|
|
42
50
|
# Add a numeric or ActiveSupport::Duration. Sub-second precision
|
|
43
51
|
# preserved by going through to_f (NOT to_i, which dropped 0.5s).
|
|
44
|
-
def +(
|
|
45
|
-
self.class.new(@nanoseconds + (
|
|
52
|
+
def +(other)
|
|
53
|
+
self.class.new(@nanoseconds + (other.to_f * NANOS_PER_SECOND).round)
|
|
46
54
|
end
|
|
47
55
|
|
|
48
56
|
def to_s
|
|
@@ -19,10 +19,16 @@ module Neo4j
|
|
|
19
19
|
|
|
20
20
|
def self.from_nanos(nanoseconds, tz_offset_seconds) = new(nanoseconds, tz_offset_seconds)
|
|
21
21
|
|
|
22
|
+
# Build from a Ruby Time — its wall clock plus its UTC offset.
|
|
23
|
+
# Reuses LocalTime's field extraction. Mirrors LocalDateTime.from_time.
|
|
24
|
+
def self.from_time(time)
|
|
25
|
+
new(LocalTime.from_time(time).nanoseconds, time.utc_offset)
|
|
26
|
+
end
|
|
27
|
+
|
|
22
28
|
# Accepts "12:34:56.123456789+01:00", "12:34:56Z", or any string
|
|
23
29
|
# containing such a time-with-offset component.
|
|
24
30
|
def self.parse(string)
|
|
25
|
-
match = string.match(/(\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?([Z
|
|
31
|
+
match = string.match(/(\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?([Z+-][\d:]*)?/)
|
|
26
32
|
raise ArgumentError, "Invalid OffsetTime format: #{string}" unless match
|
|
27
33
|
|
|
28
34
|
nanos = LocalTime.send(:parse_nanos,
|
|
@@ -32,22 +38,22 @@ module Neo4j
|
|
|
32
38
|
|
|
33
39
|
def self.parse_offset(str)
|
|
34
40
|
return 0 if str == 'Z'
|
|
35
|
-
raise ArgumentError, "Invalid timezone offset: #{str}" unless str =~ /^([
|
|
41
|
+
raise ArgumentError, "Invalid timezone offset: #{str}" unless str =~ /^([+-])(\d{2}):?(\d{2})?$/
|
|
36
42
|
|
|
37
|
-
sign =
|
|
38
|
-
sign * (
|
|
43
|
+
sign = ::Regexp.last_match(1) == '+' ? 1 : -1
|
|
44
|
+
sign * (::Regexp.last_match(2).to_i * 3600 + (::Regexp.last_match(3) || 0).to_i * 60)
|
|
39
45
|
end
|
|
40
46
|
private_class_method :parse_offset
|
|
41
47
|
|
|
42
|
-
def hour
|
|
43
|
-
def minute
|
|
44
|
-
def second
|
|
48
|
+
def hour = (@nanoseconds / NANOS_PER_HOUR) % 24
|
|
49
|
+
def minute = (@nanoseconds / NANOS_PER_MINUTE) % 60
|
|
50
|
+
def second = (@nanoseconds / NANOS_PER_SECOND) % 60
|
|
45
51
|
def nanosecond = @nanoseconds % NANOS_PER_SECOND
|
|
46
52
|
|
|
47
53
|
# Add a numeric or ActiveSupport::Duration. Sub-second precision
|
|
48
54
|
# preserved (see LocalTime#+).
|
|
49
|
-
def +(
|
|
50
|
-
self.class.new(@nanoseconds + (
|
|
55
|
+
def +(other)
|
|
56
|
+
self.class.new(@nanoseconds + (other.to_f * NANOS_PER_SECOND).round, @tz_offset_seconds)
|
|
51
57
|
end
|
|
52
58
|
|
|
53
59
|
def to_s
|
|
@@ -66,6 +72,7 @@ module Neo4j
|
|
|
66
72
|
# <=>; == still requires same fields (they're not the same value).
|
|
67
73
|
def <=>(other)
|
|
68
74
|
return nil unless other.is_a?(OffsetTime)
|
|
75
|
+
|
|
69
76
|
utc_nanos <=> other.utc_nanos
|
|
70
77
|
end
|
|
71
78
|
|
|
@@ -8,10 +8,10 @@ module Neo4j
|
|
|
8
8
|
attr_reader :srid, :x, :y, :z
|
|
9
9
|
|
|
10
10
|
# SRID constants for coordinate reference systems
|
|
11
|
-
WGS_84_2D = 4326
|
|
12
|
-
WGS_84_3D = 4979
|
|
13
|
-
CARTESIAN_2D = 7203
|
|
14
|
-
CARTESIAN_3D = 9157
|
|
11
|
+
WGS_84_2D = 4326 # Geographic 2D (longitude, latitude)
|
|
12
|
+
WGS_84_3D = 4979 # Geographic 3D (longitude, latitude, height)
|
|
13
|
+
CARTESIAN_2D = 7203 # Cartesian 2D (x, y)
|
|
14
|
+
CARTESIAN_3D = 9157 # Cartesian 3D (x, y, z)
|
|
15
15
|
|
|
16
16
|
def initialize(srid: nil, x: nil, y: nil, z: nil, longitude: nil, latitude: nil, height: nil)
|
|
17
17
|
# Handle longitude/latitude aliases for x/y
|
|
@@ -13,8 +13,8 @@ module Neo4j
|
|
|
13
13
|
|
|
14
14
|
NANOS_PER_SECOND = 1_000_000_000
|
|
15
15
|
NANOS_PER_MINUTE = 60 * NANOS_PER_SECOND
|
|
16
|
-
NANOS_PER_HOUR
|
|
17
|
-
NANOS_PER_DAY
|
|
16
|
+
NANOS_PER_HOUR = 60 * NANOS_PER_MINUTE
|
|
17
|
+
NANOS_PER_DAY = 24 * NANOS_PER_HOUR
|
|
18
18
|
|
|
19
19
|
def self.significant_fields
|
|
20
20
|
raise NotImplementedError, "#{self} must define .significant_fields"
|
|
@@ -26,6 +26,7 @@ module Neo4j
|
|
|
26
26
|
|
|
27
27
|
def <=>(other)
|
|
28
28
|
return nil unless other.is_a?(self.class)
|
|
29
|
+
|
|
29
30
|
significant <=> other.significant
|
|
30
31
|
end
|
|
31
32
|
|
data/lib/neo4j/driver/version.rb
CHANGED
data/lib/neo4j/driver.rb
CHANGED
|
@@ -65,7 +65,7 @@ Java::OrgNeo4jDriverInternal::EagerResultValue.prepend Neo4j::Driver::Ext::Inter
|
|
|
65
65
|
Java::OrgNeo4jDriverInternal::InternalDriver.prepend Neo4j::Driver::Ext::InternalDriver
|
|
66
66
|
Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::InternalEntity
|
|
67
67
|
Java::OrgNeo4jDriverInternal::InternalNode.prepend Neo4j::Driver::Ext::InternalNode
|
|
68
|
-
Java::OrgNeo4jDriverInternal::InternalNotificationSeverity.include
|
|
68
|
+
Java::OrgNeo4jDriverInternal::InternalNotificationSeverity.include Neo4j::Driver::Ext::Internal::InternalNotificationSeverity
|
|
69
69
|
Java::OrgNeo4jDriverInternal::InternalPath.include Neo4j::Driver::Ext::StartEndNaming
|
|
70
70
|
Java::OrgNeo4jDriverInternal::InternalPath::SelfContainedSegment.include Neo4j::Driver::Ext::StartEndNaming
|
|
71
71
|
Java::OrgNeo4jDriverInternal::InternalRecord.prepend Neo4j::Driver::Ext::InternalRecord
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: neo4j-ruby-driver
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.2.1.beta.
|
|
4
|
+
version: 6.2.1.beta.2
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Neo4j Driver Team
|
|
@@ -37,76 +37,6 @@ dependencies:
|
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '2.6'
|
|
40
|
-
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: csv
|
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - ">="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0'
|
|
47
|
-
type: :development
|
|
48
|
-
prerelease: false
|
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0'
|
|
54
|
-
- !ruby/object:Gem::Dependency
|
|
55
|
-
name: ffaker
|
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - ">="
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '0'
|
|
61
|
-
type: :development
|
|
62
|
-
prerelease: false
|
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - ">="
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '0'
|
|
68
|
-
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: rake
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - "~>"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '13.0'
|
|
75
|
-
type: :development
|
|
76
|
-
prerelease: false
|
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - "~>"
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '13.0'
|
|
82
|
-
- !ruby/object:Gem::Dependency
|
|
83
|
-
name: rspec
|
|
84
|
-
requirement: !ruby/object:Gem::Requirement
|
|
85
|
-
requirements:
|
|
86
|
-
- - "~>"
|
|
87
|
-
- !ruby/object:Gem::Version
|
|
88
|
-
version: '3.13'
|
|
89
|
-
type: :development
|
|
90
|
-
prerelease: false
|
|
91
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
-
requirements:
|
|
93
|
-
- - "~>"
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
version: '3.13'
|
|
96
|
-
- !ruby/object:Gem::Dependency
|
|
97
|
-
name: rspec-its
|
|
98
|
-
requirement: !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- - "~>"
|
|
101
|
-
- !ruby/object:Gem::Version
|
|
102
|
-
version: '2.0'
|
|
103
|
-
type: :development
|
|
104
|
-
prerelease: false
|
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
-
requirements:
|
|
107
|
-
- - "~>"
|
|
108
|
-
- !ruby/object:Gem::Version
|
|
109
|
-
version: '2.0'
|
|
110
40
|
- !ruby/object:Gem::Dependency
|
|
111
41
|
name: jar-dependencies
|
|
112
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -240,7 +170,8 @@ files:
|
|
|
240
170
|
homepage: https://github.com/neo4jrb/neo4j-ruby-driver
|
|
241
171
|
licenses:
|
|
242
172
|
- MIT
|
|
243
|
-
metadata:
|
|
173
|
+
metadata:
|
|
174
|
+
rubygems_mfa_required: 'true'
|
|
244
175
|
rdoc_options: []
|
|
245
176
|
require_paths:
|
|
246
177
|
- lib
|