neo4j-ruby-driver 5.27.0.alpha.0-java → 6.0.1.alpha.0-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4064ef5d82cfd2fe300cf2d52e0a35b9ba09a8b6d5cfc868650fa3d7dafb4020
4
- data.tar.gz: 99b488de69aa44cc83c9dd2a0ed3737f42653019c4f7776188c067599bae773d
3
+ metadata.gz: c174b6fb71a96ae78be2e140cdeb0918dac5e1afb5036a82abb067985c815ac2
4
+ data.tar.gz: efd9b59b2de7bc38291332ebb5eedc1af1cebb0521835e9a6735267c88ae1813
5
5
  SHA512:
6
- metadata.gz: f5be2270b61637f3867c2d2bb635003e2b463e3292d2f76874ebf244ac9a1735a7f5387a7fac1d9fd2ff298181732c2f10a36482a15759734d420045cb895532
7
- data.tar.gz: 8ccdb481223dc80fecdfdf596e0b10a75bb80327a143f882d30fa3ac23c118bd0c67f9f78145d4de95d97ca4ab8ce7666039763d2d0726e3b908bc911b30a391
6
+ metadata.gz: b5e75ea8218be1484361218a5d0300c8b9e71843bb78956cd831810c60380b9a701c63e091837e7c097ba312ba20a491d422ec830eee41e51cdb0e315760f378
7
+ data.tar.gz: dd15c10c93e58fce166e76a4d5820626f27edc74ff7722b0c7cfec18d84db5b1d3fe1bf8910c7e902d4b03c77ea859c6844537c30fc309d81c1e311e0e88e593
data/README.md CHANGED
@@ -1,12 +1,50 @@
1
- # Neo4j::Driver
1
+ # Neo4j Ruby Driver
2
2
 
3
- home :: https://github.com/neo4jrb/neo4j-ruby-driver
3
+ This repository contains 2 implementation of a Neo4j driver for Ruby:
4
4
 
5
- This repository contains 2 implementation of a neo4j driver for ruby:
6
- - based on official java implementation. It provides a thin wrapper over the java driver (only on jruby).
7
- - pure ruby implmementation. Available on all ruby versions >= 3.1.
5
+ - based on official Java implementation. It provides a thin wrapper over the Java driver (only on jruby).
6
+ - pure Ruby implementation. Available on all Ruby versions >= 3.1.
8
7
 
9
- ## Installation
8
+ Network communication is handled using [Bolt Protocol](https://7687.org/).
9
+
10
+ <details>
11
+ <summary>Table of Contents</summary>
12
+
13
+ * [Getting started](#getting-started)
14
+ * [Installation](#installation)
15
+ * [Getting a Neo4j instance](#getting-a-neo4j-instance)
16
+ * [Quick start example](#quick-start-example)
17
+ * [Server Compatibility](#server-compatibility)
18
+ * [Usage](#usage)
19
+ * [Connecting to a database](#connecting-to-a-database)
20
+ * [URI schemes](#uri-schemes)
21
+ * [Authentication](#authentication)
22
+ * [Configuration](#configuration)
23
+ * [Connectivity check](#connectivity-check)
24
+ * [Sessions & transactions](#sessions--transactions)
25
+ * [Session](#session)
26
+ * [Auto-commit transactions](#auto-commit-transactions)
27
+ * [Explicit transactions](#explicit-transactions)
28
+ * [Read transactions](#read-transactions)
29
+ * [Write transactions](#write-transactions)
30
+ * [Working with results](#working-with-results)
31
+ * [Accessing Node and Relationship data](#accessing-node-and-relationship-data)
32
+ * [Working with Paths](#working-with-paths)
33
+ * [Working with temporal types](#working-with-temporal-types)
34
+ * [Type mapping](#type-mapping)
35
+ * [Advanced](#advanced)
36
+ * [Connection pooling](#connection-pooling)
37
+ * [Logging](#logging)
38
+ * [For Driver Engineers](#for-driver-engineers)
39
+ * [Testing](#testing)
40
+ * [Contributing](#contributing)
41
+ * [License](#license)
42
+
43
+ </details>
44
+
45
+ ## Getting started
46
+
47
+ ### Installation
10
48
 
11
49
  Add this line to your application's Gemfile:
12
50
 
@@ -16,68 +54,430 @@ gem 'neo4j-ruby-driver'
16
54
 
17
55
  And then execute:
18
56
 
19
- $ bundle
57
+ ```bash
58
+ bundle install
59
+ ```
20
60
 
21
61
  Or install it yourself as:
22
62
 
23
- $ gem install neo4j-ruby-driver
63
+ ```bash
64
+ gem install neo4j-ruby-driver
65
+ ```
66
+
67
+ ### Getting a Neo4j instance
68
+
69
+ You need a running Neo4j database in order to use the driver with it. The easiest way to spin up a **local instance** is
70
+ through a Docker container.
71
+
72
+ The command below runs the latest Neo4j version in Docker, setting the admin username and password to `neo4j` and
73
+ `password` respectively:
74
+
75
+ ```bash
76
+ docker run \
77
+ -p7474:7474 \
78
+ -p7687:7687 \
79
+ -d \
80
+ -e NEO4J_AUTH=neo4j/password \
81
+ neo4j:latest
82
+ ```
83
+
84
+ ### Quick start example
85
+
86
+ ```ruby
87
+ require 'neo4j/driver'
88
+
89
+ Neo4j::Driver::GraphDatabase.driver(
90
+ 'bolt://localhost:7687',
91
+ Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
92
+ ) do |driver|
93
+ driver.session(database: 'neo4j') do |session|
94
+ query_result = session.run('RETURN 2+2 AS value')
95
+ puts "2+2 equals #{query_result.single['value']}"
96
+
97
+ # consume gives the execution summary
98
+ create_result = session.run('CREATE (n)').consume
99
+ puts "Nodes created: #{create_result.counters.nodes_created}"
100
+ end
101
+ end
102
+ ```
24
103
 
25
104
  ## Server Compatibility
26
105
 
27
- The compatibility with Neo4j Server versions is documented in the [Neo4j Knowledge Base](https://neo4j.com/developer/kb/neo4j-supported-versions/).
106
+ The compatibility with Neo4j Server versions is documented in
107
+ the [Neo4j Knowledge Base](https://neo4j.com/developer/kb/neo4j-supported-versions/).
28
108
 
29
109
  ## Usage
30
110
 
31
- The API is to highest possible degree consistent with the official java driver.
32
- At this moment [The Neo4j Drivers Manual v4.4](https://neo4j.com/docs/java-manual/current/) along with the ruby version of the [code fragments](https://github.com/neo4jrb/neo4j-ruby-driver/blob/master/docs/dev_manual_examples.rb) and the ruby specs provide the only documentation.
111
+ The API is to highest possible degree consistent with the official Java driver. Please refer to
112
+ the [Neo4j Java Driver Manual](https://neo4j.com/docs/java-manual/current/), [examples in Ruby](https://github.com/neo4jrb/neo4j-ruby-driver/blob/master/docs/dev_manual_examples.rb),
113
+ and code snippets below to understand how to use it.
114
+ [Neo4j Java Driver API Docs](https://neo4j.com/docs/api/java-driver/current/) can be helpful as well.
115
+
116
+ ### Connecting to a database
117
+
118
+ #### URI schemes
119
+
120
+ The driver supports the following URI schemes:
121
+
122
+ | URI Scheme | Description |
123
+ |----------------|---------------------------------------------------------------------------------|
124
+ | `neo4j://` | Connect using routing to a cluster/causal cluster. |
125
+ | `neo4j+s://` | Same as `neo4j://` but with full TLS encryption. |
126
+ | `neo4j+ssc://` | Same as `neo4j://` but with full TLS encryption, without hostname verification. |
127
+ | `bolt://` | Connect directly to a server using the Bolt protocol. |
128
+ | `bolt+s://` | Same as `bolt://` but with full TLS encryption. |
129
+ | `bolt+ssc://` | Same as `bolt://` but with full TLS encryption, without hostname verification. |
130
+
131
+ Example:
132
+
133
+ ```ruby
134
+ # Connect to a single instance
135
+ driver = Neo4j::Driver::GraphDatabase.driver(
136
+ 'bolt://localhost:7687',
137
+ Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
138
+ )
139
+
140
+ # Connect to a cluster
141
+ driver = Neo4j::Driver::GraphDatabase.driver(
142
+ 'neo4j://graph.example.com:7687',
143
+ Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
144
+ )
145
+ ```
146
+
147
+ #### Authentication
148
+
149
+ The driver provides multiple authentication methods:
150
+
151
+ ```ruby
152
+ # Basic authentication
153
+ auth = Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
154
+
155
+ # With realm specification
156
+ auth = Neo4j::Driver::AuthTokens.basic('neo4j', 'password', 'realm')
157
+
158
+ # Kerberos authentication
159
+ auth = Neo4j::Driver::AuthTokens.kerberos('ticket')
160
+
161
+ # Bearer authentication
162
+ auth = Neo4j::Driver::AuthTokens.bearer('token')
163
+
164
+ # Custom authentication
165
+ auth = Neo4j::Driver::AuthTokens.custom('principal', 'credentials', 'realm', 'scheme')
166
+
167
+ # No authentication
168
+ auth = Neo4j::Driver::AuthTokens.none
169
+ ```
170
+
171
+ #### Configuration
172
+
173
+ You can configure the driver with additional options:
174
+
175
+ ```ruby
176
+ config = {
177
+ connection_timeout: 15.seconds,
178
+ connection_acquisition_timeout: 1.minute,
179
+ max_transaction_retry_time: 30.seconds,
180
+ encryption: true,
181
+ trust_strategy: :trust_all_certificates
182
+ }
183
+
184
+ driver = Neo4j::Driver::GraphDatabase.driver(
185
+ 'neo4j://localhost:7687',
186
+ Neo4j::Driver::AuthTokens.basic('neo4j', 'password'),
187
+ **config
188
+ )
189
+ ```
190
+
191
+ #### Connectivity check
192
+
193
+ ```ruby
194
+ if driver.verify_connectivity
195
+ puts "Driver is connected to the database"
196
+ else
197
+ puts "Driver cannot connect to the database"
198
+ end
199
+ ```
200
+
201
+ ### Sessions & transactions
202
+
203
+ The driver provides sessions to interact with the database and to execute queries.
204
+
205
+ #### Session
206
+
207
+ Sessions are lightweight and disposable database connections. Always close your sessions when done:
208
+
209
+ ```ruby
210
+ session = driver.session(database: 'neo4j')
211
+ begin
212
+ session.run('MATCH (n) RETURN n LIMIT 10')
213
+ ensure
214
+ session.close
215
+ end
216
+ ```
217
+
218
+ Or use a block that automatically closes the session:
219
+
220
+ ```ruby
221
+ driver.session(database: 'neo4j') do |session|
222
+ session.run('MATCH (n) RETURN n LIMIT 10')
223
+ end
224
+ ```
225
+
226
+ Session options:
227
+
228
+ ```ruby
229
+ # Default database
230
+ session = driver.session
231
+
232
+ # Specific database
233
+ session = driver.session(database: 'neo4j')
234
+
235
+ # With access mode
236
+ session = driver.session(database: 'neo4j', default_access_mode: Neo4j::Driver::AccessMode::READ)
237
+
238
+ # With bookmarks for causal consistency
239
+ session = driver.session(
240
+ database: 'neo4j',
241
+ bookmarks: [Neo4j::Driver::Bookmark.from('bookmark-1')]
242
+ )
243
+ ```
244
+
245
+ #### Auto-commit transactions
246
+
247
+ For simple, one-off queries, use auto-commit transactions:
248
+
249
+ ```ruby
250
+ session.run('CREATE (n:Person {name: $name})', name: 'Alice')
251
+ ```
252
+
253
+ #### Explicit transactions
254
+
255
+ For multiple queries that need to be executed as a unit, use explicit transactions:
256
+
257
+ ```ruby
258
+ tx = session.begin_transaction
259
+ begin
260
+ tx.run('CREATE (n:Person {name: $name})', name: 'Alice')
261
+ tx.run('CREATE (n:Person {name: $name})', name: 'Bob')
262
+ tx.commit
263
+ rescue
264
+ tx.rollback
265
+ raise
266
+ end
267
+ ```
268
+
269
+ #### Read transactions
270
+
271
+ Specifically for read operations:
272
+
273
+ ```ruby
274
+ result = session.read_transaction do |tx|
275
+ tx.run('MATCH (n:Person) RETURN n.name').map { |record| record['n.name'] }
276
+ end
277
+ puts result
278
+ ```
279
+
280
+ #### Write transactions
281
+
282
+ Specifically for write operations:
283
+
284
+ ```ruby
285
+ session.write_transaction do |tx|
286
+ tx.run('CREATE (n:Person {name: $name})', name: 'Charlie')
287
+ end
288
+ ```
289
+
290
+ ### Working with results
291
+
292
+ ```ruby
293
+ result = session.run('MATCH (n:Person) RETURN n.name AS name, n.age AS age')
294
+
295
+ # Process results
296
+ result.each do |record|
297
+ puts "#{record['name']} is #{record['age']} years old"
298
+ end
299
+
300
+ # Check if there are more results
301
+ puts "Has more results: #{result.has_next?}"
302
+
303
+ # Get a single record
304
+ single = result.single
305
+ puts single['name'] if single
306
+
307
+ # Get keys available in the result
308
+ puts "Keys: #{result.keys}"
309
+
310
+ # Access by field index
311
+ result.each do |record|
312
+ puts "First field: #{record[0]}"
313
+ end
314
+
315
+ # Convert to array
316
+ records = result.to_a
317
+ ```
318
+
319
+ #### Accessing Node and Relationship data
320
+
321
+ Working with graph entities:
322
+
323
+ ```ruby
324
+ result = session.run('MATCH (p:Person)-[r:KNOWS]->(friend) RETURN p, r, friend')
325
+
326
+ result.each do |record|
327
+ # Working with nodes
328
+ person = record['p']
329
+ puts "Node ID: #{person.id}"
330
+ puts "Labels: #{person.labels.join(', ')}"
331
+ puts "Properties: #{person.properties}"
332
+ puts "Name property: #{person.properties['name']}"
333
+
334
+ # Working with relationships
335
+ relationship = record['r']
336
+ puts "Relationship ID: #{relationship.id}"
337
+ puts "Type: #{relationship.type}"
338
+ puts "Properties: #{relationship.properties}"
339
+
340
+ # Start and end nodes of the relationship
341
+ puts "Relationship: #{relationship.start_node_id} -> #{relationship.end_node_id}"
342
+ end
343
+ ```
344
+
345
+ #### Working with Paths
346
+
347
+ Processing paths returned from Cypher:
348
+
349
+ ```ruby
350
+ result = session.run('MATCH p = (:Person)-[:KNOWS*]->(:Person) RETURN p')
351
+
352
+ result.each do |record|
353
+ path = record['p']
354
+
355
+ # Get all nodes in the path
356
+ nodes = path.nodes
357
+ puts "Nodes in path: #{nodes.map { |n| n.properties['name'] }.join(' -> ')}"
358
+
359
+ # Get all relationships in the path
360
+ relationships = path.relationships
361
+ puts "Relationship types: #{relationships.map(&:type).join(', ')}"
362
+
363
+ # Iterate through the path segments
364
+ path.each do |segment|
365
+ puts "#{segment.start_node.properties['name']} -[#{segment.relationship.type}]-> #{segment.end_node.properties['name']}"
366
+ end
367
+ end
368
+ ```
369
+
370
+ #### Working with temporal types
371
+
372
+ Creating a node with properties of temporal types:
373
+
374
+ ```ruby
375
+ session.run(
376
+ 'CREATE (e:Event {datetime: $datetime, duration: $duration})',
377
+ datetime: DateTime.new(2025, 5, 5, 5, 55, 55), duration: 1.hour
378
+ )
379
+ ```
380
+
381
+ Querying temporal values:
382
+
383
+ ```ruby
384
+ session.run('MATCH (e:Event) LIMIT 1 RETURN e.datetime, e.duration').single.to_h
385
+ # => {"e.datetime": 2025-05-05 05:55:55 +0000, "e.duration": 3600 seconds}
386
+ ```
387
+
388
+ ### Type mapping
33
389
 
34
- [Neo4j Java Driver 4.3 API](https://neo4j.com/docs/api/java-driver/current/) can be helpful as well..
390
+ The Neo4j Ruby Driver maps Cypher types to Ruby types:
35
391
 
36
- ## Development
392
+ | Cypher Type | Ruby Type |
393
+ |----------------|-----------------------------------------------|
394
+ | null | nil |
395
+ | List | Enumerable |
396
+ | Map | Hash (symbolized keys) |
397
+ | Boolean | TrueClass/FalseClass |
398
+ | Integer | Integer/String[^1] |
399
+ | Float | Float |
400
+ | String | String/Symbol[^2] (encoding: UTF-8) |
401
+ | ByteArray | String (encoding: BINARY) |
402
+ | Date | Date |
403
+ | Zoned Time | Neo4j::Driver::Types::OffsetTime |
404
+ | Local Time | Neo4j::Driver::Types::LocalTime |
405
+ | Zoned DateTime | Time/ActiveSupport::TimeWithZone/DateTime[^3] |
406
+ | Local DateTime | Neo4j::Driver::Types::LocalDateTime |
407
+ | Duration | ActiveSupport::Duration |
408
+ | Point | Neo4j::Driver::Types::Point |
409
+ | Node | Neo4j::Driver::Types::Node |
410
+ | Relationship | Neo4j::Driver::Types::Relationship |
411
+ | Path | Neo4j::Driver::Types::Path |
37
412
 
38
- This gem includes 2 different implementations: java driver wrapper and pure ruby driver
413
+ [^1]: An Integer smaller than -2 ** 63 or larger than 2 ** 63 will always be implicitly converted to String
414
+ [^2]: A Symbol passed as a parameter will always be implicitly converted to String. All Strings other than BINARY
415
+ encoded are converted to UTF-8 when stored in Neo4j
416
+ [^3]: A Ruby DateTime passed as a parameter will always be implicitly converted to Time
39
417
 
40
- $ bin/setup
41
-
42
- ## Testing
418
+ ### Advanced
43
419
 
44
- To run the tests the following tools need to be installed:
420
+ #### Connection pooling
45
421
 
46
- $ brew install python
47
- $ pip3 install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit
48
- $ neoctrl-install -e 4.4.5 servers
49
- $ neoctrl-configure servers/neo4j-enterprise-4.4.5 dbms.directories.import= dbms.default_listen_address=::
50
- $ neoctrl-set-initial-password pass servers/neo4j-enterprise-4.4.5
51
- $ neoctrl-start servers/neo4j-enterprise-4.4.5
422
+ The driver handles connection pooling automatically. Configure the connection pool:
423
+
424
+ ```ruby
425
+ config = {
426
+ max_connection_pool_size: 100,
427
+ max_connection_lifetime: 1.hour
428
+ }
52
429
 
53
- To run the tests:
54
- ```console
55
- $ bin/setup
56
- $ rspec spec
430
+ driver = Neo4j::Driver::GraphDatabase.driver('neo4j://localhost:7687', auth, **config)
57
431
  ```
58
432
 
59
- Known errors:
433
+ #### Logging
60
434
 
61
- 1. In case of heap space memory error (`org.neo4j.driver.exceptions.DatabaseException: Java heap space`), you should limit the dbms memory, for example:
435
+ Configure logging for the driver:
62
436
 
63
- ```console
64
- $ neoctrl-configure servers/neo4j-enterprise-4.4.5 dbms.memory.pagecache.size=600m dbms.memory.heap.max_size=600m dbms.memory.heap.initial_size=600m dbms.directories.import= dbms.connectors.default_listen_address=::
437
+ ```ruby
438
+ config = {
439
+ logger: Logger.new(STDOUT).tap { |log| log.level = Logger::DEBUG }
440
+ }
441
+
442
+ driver = Neo4j::Driver::GraphDatabase.driver('neo4j://localhost:7687', auth, **config)
65
443
  ```
66
444
 
67
- 2. When using command `pip3 install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit`, if you have m1 mac chip, you may get error when pip3 tries to install `cryptography`. Steps to take in that case (reference https://stackoverflow.com/a/70074869/2559490)
445
+ ## For Driver Engineers
68
446
 
69
- ```console
70
- $ pip uninstall cffi
71
- $ python -m pip install --upgrade pip
72
- $ pip install cffi
73
- $ pip install cryptography
447
+ This gem includes 2 different implementations: a Java driver wrapper and a pure Ruby driver, so you will have to run
448
+ this command every time you switch the Ruby engine:
449
+
450
+ ```bash
451
+ bin/setup
74
452
  ```
75
453
 
454
+ ### Testing
455
+
456
+ There are two sets of tests for the driver. To run the specs placed in this repository, use a normal rspec command:
457
+
458
+ ```bash
459
+ rspec spec
460
+ ```
461
+
462
+ To run the [Testkit](https://github.com/neo4j-drivers/testkit) that is used to test all Neo4j driver implementations,
463
+ use the following:
464
+
465
+ ```bash
466
+ git clone git@github.com:neo4j-drivers/testkit.git
467
+ cd testkit
468
+ export TEST_DRIVER_NAME=ruby
469
+ export TEST_DRIVER_REPO=`realpath ../neo4j-ruby-driver`
470
+ export TEST_NEO4J_PASS=password
471
+ python3 main.py --tests UNIT_TESTS --configs 4.3-enterprise
472
+ ```
473
+
474
+ Please refer to the [Testkit](https://github.com/neo4j-drivers/testkit) documentation to learn more about its features.
475
+
76
476
  ## Contributing
77
477
 
78
- Suggestions, improvements, bug reports and pull requests are welcome on GitHub at https://github.com/neo4jrb/neo4j-ruby-driver.
478
+ Suggestions, improvements, bug reports and pull requests are welcome on GitHub
479
+ at https://github.com/neo4jrb/neo4j-ruby-driver.
79
480
 
80
481
  ## License
81
482
 
82
483
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
83
-
@@ -68,14 +68,14 @@ module Neo4j
68
68
 
69
69
  def notification_config(minimum_severity: nil, disabled_categories: nil)
70
70
  org.neo4j.driver.internal.InternalNotificationConfig.new(
71
- value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity),
71
+ value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity).or_else(nil),
72
72
  disabled_categories
73
- &.map { |value| value_of(org.neo4j.driver.internal.InternalNotificationCategory, value) }
73
+ &.map { |value| value_of(org.neo4j.driver.NotificationClassification, value) }
74
74
  &.then(&java.util.HashSet.method(:new)))
75
75
  end
76
76
 
77
77
  def value_of(klass, value)
78
- klass.value_of(value&.to_s&.upcase).or_else(nil)
78
+ klass.value_of(value&.to_s&.upcase)
79
79
  end
80
80
  end
81
81
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module DelegatingTransactionContext
7
+ include ExceptionCheckable
8
+ include RunOverride
9
+
10
+ def run(statement, **parameters)
11
+ check { super(to_statement(statement, parameters)) }
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -4,11 +4,11 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module GraphDatabase
7
- extend AutoClosable
7
+ extend AutoCloseable
8
8
  include ConfigConverter
9
9
  include ExceptionCheckable
10
10
 
11
- auto_closable :driver
11
+ auto_closeable :driver
12
12
 
13
13
  def driver(uri, auth_token = Neo4j::Driver::AuthTokens.none, **config)
14
14
  check do
@@ -5,7 +5,7 @@ module Neo4j::Driver::Ext
5
5
  module Cluster
6
6
  module RoutingTableRegistryImpl
7
7
  def routing_table_handler(database)
8
- get_routing_table_handler(org.neo4j.driver.internal.bolt.api.DatabaseNameUtil.database(database)).then do |it|
8
+ get_routing_table_handler(org.neo4j.driver.internal.bolt.api.DatabaseName.database(database)).then do |it|
9
9
  it.get if it.present?
10
10
  end
11
11
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module Internal
7
+ module EagerResultValue
8
+ include InternalKeys
9
+
10
+ def records
11
+ super.to_a
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -4,12 +4,22 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module InternalDriver
7
- extend AutoClosable
7
+ extend AutoCloseable
8
8
  include ConfigConverter
9
9
  include ExceptionCheckable
10
10
  include AsyncConverter
11
11
 
12
- auto_closable :session
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
13
23
 
14
24
  def session(**session_config)
15
25
  java_method(:session, [org.neo4j.driver.SessionConfig])
@@ -4,18 +4,18 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module InternalSession
7
- extend AutoClosable
7
+ extend AutoCloseable
8
8
  include ConfigConverter
9
9
  include ExceptionCheckable
10
10
  include RunOverride
11
11
 
12
- auto_closable :begin_transaction
12
+ auto_closeable :begin_transaction
13
13
 
14
14
  # work around jruby issue https://github.com/jruby/jruby/issues/5603
15
15
  Struct.new('Wrapper', :object)
16
16
 
17
- %i[read write].each do |prefix|
18
- define_method("#{prefix}_transaction") do |**config, &block|
17
+ %i[read write].each do |mode|
18
+ define_method("execute_#{mode}") do |**config, &block|
19
19
  check do
20
20
  super(->(tx) { Struct::Wrapper.new(reverse_check { block.call(tx) }) }, to_java_config(Neo4j::Driver::TransactionConfig, **config)).object
21
21
  end
@@ -34,6 +34,10 @@ module Neo4j
34
34
  def begin_transaction(**config)
35
35
  check { super(to_java_config(Neo4j::Driver::TransactionConfig, **config)) }
36
36
  end
37
+
38
+ def last_bookmarks
39
+ super.to_set
40
+ end
37
41
  end
38
42
  end
39
43
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '5.27.0.alpha.0'
5
+ VERSION = '6.0.1.alpha.0'
6
6
  end
7
7
  end
@@ -10,12 +10,13 @@ module Neo4j
10
10
 
11
11
  include_package 'org.neo4j.driver'
12
12
 
13
+ EagerResult = Java::OrgNeo4jDriverInternal::EagerResultValue
13
14
  Record = Java::OrgNeo4jDriverInternal::InternalRecord
14
15
  Result = Java::OrgNeo4jDriverInternal::InternalResult
15
16
  Transaction = Java::OrgNeo4jDriverInternal::InternalTransaction
16
17
 
17
18
  module Internal
18
- java_import org.neo4j.driver.internal.bolt.api.DatabaseNameUtil
19
+ java_import org.neo4j.driver.internal.shaded.bolt.connection.DatabaseName
19
20
  end
20
21
 
21
22
  module Net
@@ -36,10 +37,9 @@ module Neo4j
36
37
  end
37
38
 
38
39
  Java::OrgNeo4jDriver::AuthTokens.singleton_class.prepend Neo4j::Driver::Ext::AuthTokens
39
- Java::OrgNeo4jDriver::Bookmark.singleton_class.prepend Neo4j::Driver::Ext::Bookmark::ClassMethods
40
40
  Java::OrgNeo4jDriver::GraphDatabase.singleton_class.prepend Neo4j::Driver::Ext::GraphDatabase
41
41
  Java::OrgNeo4jDriver::Query.prepend Neo4j::Driver::Ext::Query
42
- Java::OrgNeo4jDriverInternal::InternalBookmark.prepend Neo4j::Driver::Ext::Internal::InternalBookmark
42
+ Java::OrgNeo4jDriverInternal::EagerResultValue.prepend Neo4j::Driver::Ext::Internal::EagerResultValue
43
43
  Java::OrgNeo4jDriverInternal::InternalDriver.prepend Neo4j::Driver::Ext::InternalDriver
44
44
  Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::InternalEntity
45
45
  Java::OrgNeo4jDriverInternal::InternalNode.prepend Neo4j::Driver::Ext::InternalNode
@@ -51,10 +51,11 @@ Java::OrgNeo4jDriverInternal::InternalRelationship.prepend Neo4j::Driver::Ext::I
51
51
  Java::OrgNeo4jDriverInternal::InternalResult.prepend Neo4j::Driver::Ext::InternalResult
52
52
  Java::OrgNeo4jDriverInternal::InternalSession.prepend Neo4j::Driver::Ext::InternalSession
53
53
  Java::OrgNeo4jDriverInternal::InternalTransaction.prepend Neo4j::Driver::Ext::InternalTransaction
54
+ Java::OrgNeo4jDriverInternal::DelegatingTransactionContext.prepend Neo4j::Driver::Ext::DelegatingTransactionContext
54
55
  Java::OrgNeo4jDriverInternalAsync::InternalAsyncSession.prepend Neo4j::Driver::Ext::Internal::Async::InternalAsyncSession
55
- Java::OrgNeo4jDriverInternalBoltRoutedimplCluster::RoutingTableRegistryImpl.include Neo4j::Driver::Ext::Internal::Cluster::RoutingTableRegistryImpl
56
+ Java::OrgNeo4jDriverInternalShadedBoltConnectionRoutedImplCluster::RoutingTableRegistryImpl.include Neo4j::Driver::Ext::Internal::Cluster::RoutingTableRegistryImpl
56
57
  # Java::OrgNeo4jDriverInternalCursor::DisposableAsyncResultCursor.prepend Neo4j::Driver::Ext::Internal::Cursor::DisposableAsyncResultCursor
57
- Java::OrgNeo4jDriverInternalMetrics::InternalConnectionPoolMetrics.include Neo4j::Driver::Ext::Internal::Metrics::InternalConnectionPoolMetrics
58
+ Java::OrgNeo4jDriverObservationMetricsInternal::InternalConnectionPoolMetrics.include Neo4j::Driver::Ext::Internal::Metrics::InternalConnectionPoolMetrics
58
59
  Java::OrgNeo4jDriverInternalSummary::InternalNotification.prepend Neo4j::Driver::Ext::Internal::Summary::InternalNotification
59
60
  Java::OrgNeo4jDriverInternalSummary::InternalPlan.prepend Neo4j::Driver::Ext::Internal::Summary::InternalPlan
60
61
  Java::OrgNeo4jDriverInternalSummary::InternalResultSummary.prepend Neo4j::Driver::Ext::Internal::Summary::InternalResultSummary
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- module AutoClosable
6
- def auto_closable(*methods)
5
+ module AutoCloseable
6
+ def auto_closeable(*methods)
7
7
  prepend with_block_definer(methods)
8
8
  end
9
9
 
@@ -13,15 +13,15 @@ module Neo4j
13
13
  Module.new do
14
14
  methods.each do |method|
15
15
  define_method(method) do |*args, **kwargs, &block|
16
- closable = super(*args, **kwargs)
16
+ closeable = super(*args, **kwargs)
17
17
  if block
18
18
  begin
19
- block.arity.zero? ? closable.instance_eval(&block) : block.call(closable)
19
+ block.arity.zero? ? closeable.instance_eval(&block) : block.call(closeable)
20
20
  ensure
21
- closable&.close
21
+ closeable&.close
22
22
  end
23
23
  else
24
- closable
24
+ closeable
25
25
  end
26
26
  end
27
27
  end
@@ -0,0 +1,15 @@
1
+ module Neo4j
2
+ module Driver
3
+ module Internal
4
+ module Deprecator
5
+ def self.deprecator
6
+ @deprecator ||= ActiveSupport::Deprecation.new('6.0', 'neo4j-ruby-driver')
7
+ end
8
+
9
+ def self.log_warning(old_method, new_method, version)
10
+ deprecator.deprecation_warning(old_method, new_method)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-ruby-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.27.0.alpha.0
4
+ version: 6.0.1.alpha.0
5
5
  platform: java
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -24,6 +23,20 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '7.1'
26
+ - !ruby/object:Gem::Dependency
27
+ name: csv
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: zeitwerk
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +69,16 @@ dependencies:
56
69
  name: jar-dependencies
57
70
  requirement: !ruby/object:Gem::Requirement
58
71
  requirements:
59
- - - '='
72
+ - - ">="
60
73
  - !ruby/object:Gem::Version
61
- version: 0.4.1
74
+ version: 0.5.5
62
75
  type: :runtime
63
76
  prerelease: false
64
77
  version_requirements: !ruby/object:Gem::Requirement
65
78
  requirements:
66
- - - '='
79
+ - - ">="
67
80
  - !ruby/object:Gem::Version
68
- version: 0.4.1
81
+ version: 0.5.5
69
82
  - !ruby/object:Gem::Dependency
70
83
  name: ffaker
71
84
  requirement: !ruby/object:Gem::Requirement
@@ -226,8 +239,8 @@ files:
226
239
  - jruby/neo4j/driver.rb
227
240
  - jruby/neo4j/driver/ext/async_converter.rb
228
241
  - jruby/neo4j/driver/ext/auth_tokens.rb
229
- - jruby/neo4j/driver/ext/bookmark.rb
230
242
  - jruby/neo4j/driver/ext/config_converter.rb
243
+ - jruby/neo4j/driver/ext/delegating_transaction_context.rb
231
244
  - jruby/neo4j/driver/ext/exception_checkable.rb
232
245
  - jruby/neo4j/driver/ext/exception_mapper.rb
233
246
  - jruby/neo4j/driver/ext/graph_database.rb
@@ -235,7 +248,7 @@ files:
235
248
  - jruby/neo4j/driver/ext/internal/cluster/routing_table_registry_impl.rb
236
249
  - jruby/neo4j/driver/ext/internal/cursor/disposable_async_result_cursor.rb
237
250
  - jruby/neo4j/driver/ext/internal/driver_factory.rb
238
- - jruby/neo4j/driver/ext/internal/internal_bookmark.rb
251
+ - jruby/neo4j/driver/ext/internal/eager_result_value.rb
239
252
  - jruby/neo4j/driver/ext/internal/metrics/internal_connection_pool_metrics.rb
240
253
  - jruby/neo4j/driver/ext/internal/summary/internal_notification.rb
241
254
  - jruby/neo4j/driver/ext/internal/summary/internal_plan.rb
@@ -259,7 +272,7 @@ files:
259
272
  - jruby/neo4j/driver/version.rb
260
273
  - lib/neo4j-ruby-driver.rb
261
274
  - lib/neo4j-ruby-driver_loader.rb
262
- - lib/neo4j/driver/auto_closable.rb
275
+ - lib/neo4j/driver/auto_closeable.rb
263
276
  - lib/neo4j/driver/exceptions/authentication_exception.rb
264
277
  - lib/neo4j/driver/exceptions/authorization_expired_exception.rb
265
278
  - lib/neo4j/driver/exceptions/certificate_exception.rb
@@ -287,6 +300,7 @@ files:
287
300
  - lib/neo4j/driver/exceptions/value/unsizable.rb
288
301
  - lib/neo4j/driver/exceptions/value/value_exception.rb
289
302
  - lib/neo4j/driver/internal/bolt_server_address.rb
303
+ - lib/neo4j/driver/internal/deprecator.rb
290
304
  - lib/neo4j/driver/internal/duration_normalizer.rb
291
305
  - lib/neo4j/driver/internal/validator.rb
292
306
  - lib/neo4j/driver/summary/query_type.rb
@@ -302,7 +316,6 @@ licenses:
302
316
  - MIT
303
317
  metadata:
304
318
  homepage_uri: https://github.com/neo4jrb/neo4j-ruby-driver
305
- post_install_message:
306
319
  rdoc_options:
307
320
  - "--main"
308
321
  - README.md
@@ -316,13 +329,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
316
329
  version: '3.1'
317
330
  required_rubygems_version: !ruby/object:Gem::Requirement
318
331
  requirements:
319
- - - ">"
332
+ - - ">="
320
333
  - !ruby/object:Gem::Version
321
- version: 1.3.1
334
+ version: '0'
322
335
  requirements:
323
- - jar org.neo4j.driver, neo4j-java-driver-all, 5.27.0
324
- rubygems_version: 3.3.26
325
- signing_key:
336
+ - jar org.neo4j.driver, neo4j-java-driver-all, 6.0.1
337
+ - jar org.neo4j.driver, neo4j-java-driver-observation-metrics, 6.0.1
338
+ rubygems_version: 3.6.9
326
339
  specification_version: 4
327
340
  summary: ''
328
341
  test_files: []
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Neo4j
4
- module Driver
5
- module Ext
6
- module Bookmark
7
- module ClassMethods
8
- def from(*values)
9
- super(java.util.HashSet.new(values))
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- module Neo4j
2
- module Driver
3
- module Ext
4
- module Internal
5
- module InternalBookmark
6
- def values
7
- super.to_set
8
- end
9
- end
10
- end
11
- end
12
- end
13
- end