neo4j-ruby-driver 6.0.3.alpha.0-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/README.md +113 -411
- data/lib/neo4j/driver/auth_token_manager.rb +29 -0
- data/lib/neo4j/driver/client_certificate_manager.rb +31 -0
- data/lib/neo4j/driver/exceptions/neo4j_exception.rb +16 -7
- data/lib/neo4j/driver/exceptions/no_such_record_exception.rb +1 -1
- data/lib/neo4j/driver/exceptions/protocol_exception.rb +0 -5
- data/lib/neo4j/driver/exceptions/security_retryable_exception.rb +14 -0
- data/lib/neo4j/driver/exceptions/transaction_terminated_exception.rb +13 -0
- data/lib/neo4j/driver/ext/auth_token.rb +17 -0
- data/{jruby → lib}/neo4j/driver/ext/auth_tokens.rb +5 -1
- data/lib/neo4j/driver/ext/bookmark_managers.rb +21 -0
- data/lib/neo4j/driver/ext/client_certificates.rb +21 -0
- data/{jruby → lib}/neo4j/driver/ext/config_converter.rb +36 -7
- data/{jruby → lib}/neo4j/driver/ext/exception_checkable.rb +3 -3
- data/lib/neo4j/driver/ext/exception_mapper.rb +173 -0
- data/lib/neo4j/driver/ext/graph_database.rb +25 -0
- data/lib/neo4j/driver/ext/internal/clock_adapter.rb +33 -0
- data/lib/neo4j/driver/ext/internal/cluster/routing_table_registry_impl.rb +28 -0
- data/lib/neo4j/driver/ext/internal/driver_factory.rb +54 -0
- data/lib/neo4j/driver/ext/internal/internal_notification_severity.rb +15 -0
- data/lib/neo4j/driver/ext/internal/reflection.rb +22 -0
- data/lib/neo4j/driver/ext/internal/summary/internal_gql_notification.rb +22 -0
- data/lib/neo4j/driver/ext/internal/summary/internal_gql_status_object.rb +18 -0
- data/{jruby → lib}/neo4j/driver/ext/internal/summary/internal_plan.rb +3 -5
- data/lib/neo4j/driver/ext/internal/summary/internal_query_profile.rb +36 -0
- data/lib/neo4j/driver/ext/internal/summary/internal_result_summary.rb +44 -0
- data/lib/neo4j/driver/ext/internal_driver.rb +102 -0
- data/{jruby → lib}/neo4j/driver/ext/internal_result.rb +2 -2
- data/{jruby → lib}/neo4j/driver/ext/internal_session.rb +5 -1
- data/lib/neo4j/driver/ext/logger.rb +55 -0
- data/lib/neo4j/driver/ext/map_converter.rb +13 -0
- data/lib/neo4j/driver/ext/neo_converter.rb +70 -0
- data/lib/neo4j/driver/ext/plain_map_converter.rb +11 -0
- data/{jruby → lib}/neo4j/driver/ext/ruby_converter.rb +20 -6
- data/lib/neo4j/driver/ext/unsupported_type.rb +14 -0
- data/lib/neo4j/driver/internal/deprecator.rb +9 -5
- data/lib/neo4j/driver/internal/duration_normalizer.rb +14 -39
- data/lib/neo4j/driver/internal/internal_auth_token_manager.rb +37 -0
- data/lib/neo4j/driver/internal/validator.rb +16 -2
- data/lib/neo4j/driver/summary/query_type.rb +5 -1
- data/lib/neo4j/driver/types/duration.rb +76 -0
- data/lib/neo4j/driver/types/local_date_time.rb +77 -8
- data/lib/neo4j/driver/types/local_time.rb +50 -7
- data/lib/neo4j/driver/types/offset_time.rb +78 -7
- data/lib/neo4j/driver/types/point.rb +38 -18
- data/lib/neo4j/driver/types/temporal_value.rb +44 -0
- data/lib/neo4j/driver/types/unresolvable_zoned_date_time.rb +38 -0
- data/{jruby → lib}/neo4j/driver/version.rb +1 -1
- data/{jruby → lib}/neo4j/driver.rb +31 -7
- data/lib/neo4j-ruby-driver_jars.rb +14 -0
- data/lib/neo4j-ruby-driver_loader.rb +34 -20
- data/lib/org/neo4j/driver/neo4j-java-driver-all/6.2.1/neo4j-java-driver-all-6.2.1.jar +0 -0
- data/lib/org/neo4j/driver/neo4j-java-driver-observation-metrics/6.2.1/neo4j-java-driver-observation-metrics-6.2.1.jar +0 -0
- data/lib/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar +0 -0
- metadata +76 -226
- data/jruby/neo4j/driver/ext/async_converter.rb +0 -55
- data/jruby/neo4j/driver/ext/exception_mapper.rb +0 -92
- data/jruby/neo4j/driver/ext/graph_database.rb +0 -33
- data/jruby/neo4j/driver/ext/internal/async/internal_async_session.rb +0 -23
- data/jruby/neo4j/driver/ext/internal/cluster/routing_table_registry_impl.rb +0 -15
- data/jruby/neo4j/driver/ext/internal/cursor/disposable_async_result_cursor.rb +0 -15
- data/jruby/neo4j/driver/ext/internal/driver_factory.rb +0 -24
- data/jruby/neo4j/driver/ext/internal/summary/internal_result_summary.rb +0 -34
- data/jruby/neo4j/driver/ext/internal_driver.rb +0 -52
- data/jruby/neo4j/driver/ext/logger.rb +0 -60
- data/jruby/neo4j/driver/ext/map_converter.rb +0 -14
- data/jruby/neo4j/driver/ext/neo_converter.rb +0 -59
- data/lib/neo4j/driver/internal/bolt_server_address.rb +0 -97
- data/lib/neo4j/driver/synchronizable.rb +0 -23
- data/lib/neo4j/driver/types/time.rb +0 -45
- /data/{jruby → lib}/neo4j/driver/ext/internal/abstract_query_runner.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/internal/eager_result_value.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/internal/metrics/internal_connection_pool_metrics.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/internal/summary/internal_notification.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/internal_entity.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/internal_keys.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/internal_node.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/internal_record.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/internal_relationship.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/internal_transaction.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/query.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/run_override.rb +0 -0
- /data/{jruby → lib}/neo4j/driver/ext/start_end_naming.rb +0 -0
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Neo4j::Driver::Ext
|
|
4
|
-
module Internal
|
|
5
|
-
module Cluster
|
|
6
|
-
module RoutingTableRegistryImpl
|
|
7
|
-
def routing_table_handler(database)
|
|
8
|
-
get_routing_table_handler(org.neo4j.driver.internal.bolt.api.DatabaseName.database(database)).then do |it|
|
|
9
|
-
it.get if it.present?
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module Neo4j
|
|
2
|
-
module Driver
|
|
3
|
-
module Ext
|
|
4
|
-
module Internal
|
|
5
|
-
class DriverFactory < org.neo4j.driver.internal.DriverFactory
|
|
6
|
-
def initialize(&domain_name_resolver)
|
|
7
|
-
super()
|
|
8
|
-
@domain_name_resolver = ->(name) do
|
|
9
|
-
domain_name_resolver.call(name).map do |addr|
|
|
10
|
-
java.net.InetAddress.get_by_name(addr)
|
|
11
|
-
rescue java.net.UnknownHostException => e
|
|
12
|
-
raise java.lang.RuntimeException.new(e)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def getDomainNameResolver
|
|
18
|
-
@domain_name_resolver
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Neo4j
|
|
4
|
-
module Driver
|
|
5
|
-
module Ext
|
|
6
|
-
module Internal
|
|
7
|
-
module Summary
|
|
8
|
-
module InternalResultSummary
|
|
9
|
-
java_import org.neo4j.driver.summary.QueryType
|
|
10
|
-
|
|
11
|
-
%i[result_available_after result_consumed_after].each do |method|
|
|
12
|
-
define_method(method) do
|
|
13
|
-
super(Java::JavaUtilConcurrent::TimeUnit::MILLISECONDS).then { |val| val unless val == -1 }
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def query_type
|
|
18
|
-
case super
|
|
19
|
-
when QueryType::READ_ONLY
|
|
20
|
-
Driver::Summary::QueryType::READ_ONLY
|
|
21
|
-
when QueryType::READ_WRITE
|
|
22
|
-
Driver::Summary::QueryType::READ_WRITE
|
|
23
|
-
when QueryType::WRITE_ONLY
|
|
24
|
-
Driver::Summary::QueryType::WRITE_ONLY
|
|
25
|
-
when QueryType::SCHEMA_WRITE
|
|
26
|
-
Driver::Summary::QueryType::SCHEMA_WRITE
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Neo4j
|
|
4
|
-
module Driver
|
|
5
|
-
module Ext
|
|
6
|
-
module InternalDriver
|
|
7
|
-
extend AutoCloseable
|
|
8
|
-
include ConfigConverter
|
|
9
|
-
include ExceptionCheckable
|
|
10
|
-
include AsyncConverter
|
|
11
|
-
|
|
12
|
-
auto_closeable :session
|
|
13
|
-
|
|
14
|
-
def execute_query(query, auth_token = nil, config = {}, **parameters)
|
|
15
|
-
check do
|
|
16
|
-
executable_query(query)
|
|
17
|
-
.with_auth_token(auth_token)
|
|
18
|
-
.with_config(to_java_config(Neo4j::Driver::QueryConfig, **config))
|
|
19
|
-
.with_parameters(to_neo(parameters))
|
|
20
|
-
.execute
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def session(**session_config)
|
|
25
|
-
java_method(:session, [org.neo4j.driver.SessionConfig])
|
|
26
|
-
.call(to_java_config(Neo4j::Driver::SessionConfig, **session_config))
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def async_session(**session_config)
|
|
30
|
-
java_method(:asyncSession, [org.neo4j.driver.SessionConfig])
|
|
31
|
-
.call(to_java_config(Neo4j::Driver::SessionConfig, **session_config))
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def close_async
|
|
35
|
-
to_future(super)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def verify_connectivity
|
|
39
|
-
check { super }
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def verify_authentication(auth_token)
|
|
43
|
-
check { super }
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def supports_session_auth?
|
|
47
|
-
check { supports_session_auth }
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Neo4j
|
|
4
|
-
module Driver
|
|
5
|
-
module Ext
|
|
6
|
-
class Logger
|
|
7
|
-
include org.neo4j.driver.Logger
|
|
8
|
-
include org.neo4j.driver.Logging
|
|
9
|
-
|
|
10
|
-
delegate :debug?, to: :@active_support_logger
|
|
11
|
-
|
|
12
|
-
def initialize(active_support_logger)
|
|
13
|
-
@active_support_logger = active_support_logger
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def getLog(_name)
|
|
17
|
-
self
|
|
18
|
-
end
|
|
19
|
-
alias get_log getLog
|
|
20
|
-
|
|
21
|
-
def error(*args)
|
|
22
|
-
add(::Logger::ERROR, format(*args))
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def info(*args)
|
|
26
|
-
add(::Logger::INFO, format(*args))
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def warn(*args)
|
|
30
|
-
add(::Logger::WARN, format(*args))
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def debug(*args)
|
|
34
|
-
add(::Logger::DEBUG, format(*args))
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
alias trace debug
|
|
38
|
-
|
|
39
|
-
def trace_enabled?
|
|
40
|
-
debug?
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def debug_enabled
|
|
44
|
-
debug?
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
private
|
|
48
|
-
|
|
49
|
-
def add(level, *args)
|
|
50
|
-
@active_support_logger.add(level) { format(*args) }
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def format(*args)
|
|
54
|
-
args.unshift('%s%n%s') if args.last.is_a? java.lang.Throwable
|
|
55
|
-
java.lang.String.format(*args)
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Neo4j
|
|
4
|
-
module Driver
|
|
5
|
-
module Ext
|
|
6
|
-
module MapConverter
|
|
7
|
-
def to_h
|
|
8
|
-
java_method(:asMap, [java.util.function.Function]).call(&:itself).to_hash
|
|
9
|
-
.transform_values!(&:as_ruby_object).symbolize_keys!
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Neo4j
|
|
4
|
-
module Driver
|
|
5
|
-
module Ext
|
|
6
|
-
module NeoConverter
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
def to_neo(object, skip_unknown: false)
|
|
10
|
-
case object
|
|
11
|
-
when Hash
|
|
12
|
-
object.map { |key, value| [key.to_s, to_neo(value)] }.to_h
|
|
13
|
-
when Types::Path
|
|
14
|
-
Exceptions::ClientException.unable_to_convert(object)
|
|
15
|
-
when Enumerable
|
|
16
|
-
object.map(&method(:to_neo))
|
|
17
|
-
when String
|
|
18
|
-
object.encoding == Encoding::BINARY ? object.to_java_bytes : object
|
|
19
|
-
when ActiveSupport::Duration
|
|
20
|
-
Java::OrgNeo4jDriverInternal::InternalIsoDuration.new(
|
|
21
|
-
*Driver::Internal::DurationNormalizer.normalize(object)
|
|
22
|
-
)
|
|
23
|
-
when Types::Point
|
|
24
|
-
Java::OrgNeo4jDriver::Values.point(object.srid, *object.coordinates)
|
|
25
|
-
when Types::OffsetTime
|
|
26
|
-
Java::JavaTime::OffsetTime.of(object.hour, object.min, object.sec,
|
|
27
|
-
object.nsec, Java::JavaTime::ZoneOffset.of_total_seconds(object.utc_offset))
|
|
28
|
-
when Types::LocalTime
|
|
29
|
-
Java::JavaTime::LocalTime.of(object.hour, object.min, object.sec, object.nsec)
|
|
30
|
-
when Types::LocalDateTime
|
|
31
|
-
Java::JavaTime::LocalDateTime.of(object.year, object.month, object.day, object.hour, object.min, object.sec,
|
|
32
|
-
object.nsec)
|
|
33
|
-
when ActiveSupport::TimeWithZone
|
|
34
|
-
to_zoned_date_time(object, object.time_zone.tzinfo.identifier)
|
|
35
|
-
when Time, DateTime
|
|
36
|
-
to_zoned_date_time(object, object.formatted_offset)
|
|
37
|
-
when Date
|
|
38
|
-
Java::JavaTime::LocalDate.of(object.year, object.month, object.day)
|
|
39
|
-
when Symbol
|
|
40
|
-
object.to_s
|
|
41
|
-
when nil, true, false, Integer, Float
|
|
42
|
-
object
|
|
43
|
-
else
|
|
44
|
-
if skip_unknown
|
|
45
|
-
object
|
|
46
|
-
else
|
|
47
|
-
raise Exceptions::ClientException.unable_to_convert(object)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def to_zoned_date_time(object, zone)
|
|
53
|
-
Java::JavaTime::ZonedDateTime.of(object.year, object.month, object.day, object.hour, object.min, object.sec,
|
|
54
|
-
object.nsec, Java::JavaTime::ZoneId.of(zone))
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
module Neo4j::Driver
|
|
2
|
-
module Internal
|
|
3
|
-
# Holds a host and port pair that denotes a Bolt server address.
|
|
4
|
-
class BoltServerAddress
|
|
5
|
-
attr_reader :host, :connection_host, :port
|
|
6
|
-
delegate :hash, to: :attributes
|
|
7
|
-
|
|
8
|
-
DEFAULT_PORT = 7687
|
|
9
|
-
|
|
10
|
-
class << self
|
|
11
|
-
def host_from(uri)
|
|
12
|
-
uri&.host || (raise invalid_address_format(uri))
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def port_from(uri)
|
|
16
|
-
uri&.port || DEFAULT_PORT
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def uri_from(address)
|
|
20
|
-
scheme_split = address.split('://')
|
|
21
|
-
|
|
22
|
-
if scheme_split.length == 1
|
|
23
|
-
# URI can't parse addresses without scheme, prepend fake "bolt://" to reuse the parsing facility
|
|
24
|
-
scheme = 'bolt://'
|
|
25
|
-
host_port = host_port_from(scheme_split.first)
|
|
26
|
-
elsif scheme_split.length == 2
|
|
27
|
-
scheme = "#{scheme_split.first}://"
|
|
28
|
-
host_port = host_port_from(scheme_split.second)
|
|
29
|
-
else
|
|
30
|
-
raise invalid_address_format(address)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
URI(scheme + host_port)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def host_port_from(address)
|
|
37
|
-
# expected to be an IPv6 address like [::1] or [::1]:7687
|
|
38
|
-
return address if address.start_with?('[')
|
|
39
|
-
|
|
40
|
-
contains_single_colon = address.index(':') == address.rindex(':')
|
|
41
|
-
|
|
42
|
-
# expected to be an IPv4 address with or without port like 127.0.0.1 or 127.0.0.1:7687
|
|
43
|
-
return address if contains_single_colon
|
|
44
|
-
|
|
45
|
-
# address contains multiple colons and does not start with '['
|
|
46
|
-
# expected to be an IPv6 address without brackets
|
|
47
|
-
"[#{address}]"
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def invalid_address_format(address)
|
|
51
|
-
ArgumentError.new("Invalid address format #{address}")
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def require_valid_port(port)
|
|
55
|
-
return port if port >= 0 && port <= 65_535
|
|
56
|
-
|
|
57
|
-
raise ArgumentError, "Illegal port: #{port}"
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def initialize(uri: nil, host: self.class.host_from(uri), port: self.class.port_from(uri), connection_host: host)
|
|
62
|
-
@host = Validator.require_non_nil!(host)
|
|
63
|
-
@connection_host = Validator.require_non_nil!(connection_host)
|
|
64
|
-
@port = self.class.require_valid_port(port)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
LOCAL_DEFAULT = new(host: 'localhost', port: DEFAULT_PORT)
|
|
68
|
-
|
|
69
|
-
def self.from(address)
|
|
70
|
-
address.is_a?(BoltServerAddress) ? address : new(host: address.host, port: address.port)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def ==(other)
|
|
74
|
-
attributes == other&.attributes
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
alias eql? ==
|
|
78
|
-
|
|
79
|
-
def to_s
|
|
80
|
-
"#{host}#{"(#{connection_host})" unless host == connection_host}:#{port}"
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# Create a stream of unicast addresses.
|
|
84
|
-
# <p>
|
|
85
|
-
# While this implementation just returns a stream of itself, the subclasses may provide multiple addresses.
|
|
86
|
-
|
|
87
|
-
# @return stream of unicast addresses.
|
|
88
|
-
def unicast_stream
|
|
89
|
-
Set[self]
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def attributes
|
|
93
|
-
[@host, @connection_host, @port]
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Neo4j
|
|
4
|
-
module Driver
|
|
5
|
-
module Synchronizable
|
|
6
|
-
def sync(*methods)
|
|
7
|
-
prepend with_sync_wrapper(methods)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
def with_sync_wrapper(methods)
|
|
13
|
-
Module.new do
|
|
14
|
-
methods.each do |method|
|
|
15
|
-
define_method(method) do |*args, **kwargs, &block|
|
|
16
|
-
Sync { super(*args, **kwargs, &block) }
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Neo4j
|
|
4
|
-
module Driver
|
|
5
|
-
module Types
|
|
6
|
-
class Time
|
|
7
|
-
include Comparable
|
|
8
|
-
|
|
9
|
-
delegate :hash, :to_a, to: :significant
|
|
10
|
-
|
|
11
|
-
class << self
|
|
12
|
-
def parse(date)
|
|
13
|
-
new(::Time.parse(date))
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def initialize(time)
|
|
18
|
-
@time = time
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def significant
|
|
22
|
-
self.class.significant_fields.map(&method(:send))
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def <=>(other)
|
|
26
|
-
return unless other.is_a?(self.class)
|
|
27
|
-
|
|
28
|
-
self.class.significant_fields.reduce(0) do |acc, elem|
|
|
29
|
-
acc.zero? ? send(elem) <=> other.send(elem) : (break acc)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def ==(other)
|
|
34
|
-
other.is_a?(self.class) && self.class.significant_fields.all? { |elem| send(elem) == other.send(elem) }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
alias eql? ==
|
|
38
|
-
|
|
39
|
-
def +(numeric)
|
|
40
|
-
self.class.new(@time + numeric)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|