boltless 1.6.0 → 1.6.1
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/Dockerfile +1 -1
- data/Gemfile +3 -3
- data/lib/boltless/extensions/connection_pool.rb +7 -8
- data/lib/boltless/extensions/operations.rb +8 -8
- data/lib/boltless/extensions/transactions.rb +7 -7
- data/lib/boltless/extensions/utilities.rb +5 -5
- data/lib/boltless/request.rb +13 -13
- data/lib/boltless/result.rb +3 -3
- data/lib/boltless/result_row.rb +2 -2
- data/lib/boltless/version.rb +1 -1
- data/spec/boltless/extensions/connection_pool_spec.rb +1 -1
- data/spec/boltless/extensions/transactions_spec.rb +6 -6
- data/spec/boltless/request_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be9714a261e455fc60abca29af5d1ca6fa7b8fc3432e470f9d4ee081b8c5ac2e
|
4
|
+
data.tar.gz: a4d9a56f1d4bad89cb9d2bb4a20a12cc7ad2275a6b178610cd4deff3f37c5544
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc326d69c64d09ba47e54d8f4950ed2a8a09f8057084abb6551616365f8ddd0da53f04d188826639f3bcb2440a2d3114daf6136977c0b68622b122dc63273e8e
|
7
|
+
data.tar.gz: e432b377429d7b3ee99d83777bad37d458698bfec8f16d35dcbdbaa74e615a54c95dfe2712c56b93f18c474ee5bce5ae0d18d3d90f87fe42f642d5307eb20a63
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
@@ -15,9 +15,9 @@ gem 'countless', '~> 1.1'
|
|
15
15
|
gem 'guard-rspec', '~> 4.7'
|
16
16
|
gem 'irb', '~> 1.2'
|
17
17
|
gem 'rspec', '~> 3.12'
|
18
|
-
gem 'rubocop'
|
19
|
-
gem 'rubocop-rails'
|
20
|
-
gem 'rubocop-rspec'
|
18
|
+
gem 'rubocop'
|
19
|
+
gem 'rubocop-rails'
|
20
|
+
gem 'rubocop-rspec'
|
21
21
|
gem 'simplecov', '>= 0.22'
|
22
22
|
gem 'yard', '>= 0.9.28'
|
23
23
|
gem 'yard-activesupport-concern', '>= 0.0.1'
|
@@ -4,8 +4,8 @@ module Boltless
|
|
4
4
|
module Extensions
|
5
5
|
# A top-level gem-module extension to add easy-to-use connection pool.
|
6
6
|
#
|
7
|
-
# rubocop:disable Metrics/BlockLength because this is how
|
8
|
-
#
|
7
|
+
# rubocop:disable Metrics/BlockLength -- because this is how an
|
8
|
+
# +ActiveSupport::Concern+ looks like
|
9
9
|
module ConnectionPool
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
@@ -21,9 +21,8 @@ module Boltless
|
|
21
21
|
#
|
22
22
|
# @raise [HTTP::Error] in case the upstream server did not come up
|
23
23
|
#
|
24
|
-
# rubocop:disable Metrics/MethodLength because of the
|
25
|
-
#
|
26
|
-
# rubocop:disable Metrics/AbcSize dito
|
24
|
+
# rubocop:disable Metrics/MethodLength -- because of the retry logic
|
25
|
+
# rubocop:disable Metrics/AbcSize -- ditto
|
27
26
|
def wait_for_server!(connection)
|
28
27
|
# Check if the server already accepted connections
|
29
28
|
return connection if @upstream_is_ready
|
@@ -75,9 +74,9 @@ module Boltless
|
|
75
74
|
# @see https://github.com/mperham/connection_pool
|
76
75
|
# @return [::ConnectionPool] the connection pool instance
|
77
76
|
#
|
78
|
-
# rubocop:disable Metrics/MethodLength because of the
|
79
|
-
#
|
80
|
-
# rubocop:disable Metrics/AbcSize
|
77
|
+
# rubocop:disable Metrics/MethodLength -- because of the connection
|
78
|
+
# configuration
|
79
|
+
# rubocop:disable Metrics/AbcSize -- ditto
|
81
80
|
def connection_pool
|
82
81
|
@connection_pool ||= begin
|
83
82
|
conf = Boltless.configuration
|
@@ -4,8 +4,8 @@ module Boltless
|
|
4
4
|
module Extensions
|
5
5
|
# A top-level gem-module extension for neo4j operations.
|
6
6
|
#
|
7
|
-
# rubocop:disable Metrics/BlockLength because this is how
|
8
|
-
#
|
7
|
+
# rubocop:disable Metrics/BlockLength -- because this is how an
|
8
|
+
# +ActiveSupport::Concern+ looks like
|
9
9
|
module Operations
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
@@ -16,11 +16,11 @@ module Boltless
|
|
16
16
|
#
|
17
17
|
# @param database [String, Symbol] the neo4j database to use
|
18
18
|
#
|
19
|
-
# rubocop:disable Metrics/MethodLength because of
|
20
|
-
#
|
21
|
-
# rubocop:disable Metrics/AbcSize because of the extra transaction
|
22
|
-
# handlings (we cannot do multiple structural changes in
|
23
|
-
# transaction)
|
19
|
+
# rubocop:disable Metrics/MethodLength -- because of multiple
|
20
|
+
# transactions
|
21
|
+
# rubocop:disable Metrics/AbcSize -- because of the extra transaction
|
22
|
+
# handlings (we cannot do multiple structural changes in
|
23
|
+
# a single transaction)
|
24
24
|
def clear_database!(database: Boltless.configuration.default_db)
|
25
25
|
logger.warn('Clear neo4j database ..')
|
26
26
|
|
@@ -100,7 +100,7 @@ module Boltless
|
|
100
100
|
# @param on [String] the collection of nodes/properties to index
|
101
101
|
# @param database [String, Symbol] the neo4j database to use
|
102
102
|
#
|
103
|
-
# rubocop:disable Metrics/ParameterLists because of the various
|
103
|
+
# rubocop:disable Metrics/ParameterLists -- because of the various
|
104
104
|
# configuration options of a neo4j index
|
105
105
|
def add_index(name:, for:, on:, type: :btree, options: nil,
|
106
106
|
database: Boltless.configuration.default_db)
|
@@ -5,9 +5,9 @@ module Boltless
|
|
5
5
|
# A top-level gem-module extension to add easy-to-use methods to use the
|
6
6
|
# Cypher transactional API.
|
7
7
|
#
|
8
|
-
# rubocop:disable Metrics/BlockLength because this is how
|
9
|
-
#
|
10
|
-
# rubocop:disable Metrics/ModuleLength
|
8
|
+
# rubocop:disable Metrics/BlockLength -- because this is how an
|
9
|
+
# +ActiveSupport::Concern+ looks like
|
10
|
+
# rubocop:disable Metrics/ModuleLength -- ditto
|
11
11
|
module Transactions
|
12
12
|
extend ActiveSupport::Concern
|
13
13
|
|
@@ -149,8 +149,8 @@ module Boltless
|
|
149
149
|
#
|
150
150
|
# @raise [Mixed] when an exception occurs inside the user given block
|
151
151
|
#
|
152
|
-
# rubocop:disable Metrics/MethodLength because of the extra
|
153
|
-
#
|
152
|
+
# rubocop:disable Metrics/MethodLength -- because of the extra error
|
153
|
+
# handling
|
154
154
|
def one_shot(access_mode = :write,
|
155
155
|
database: Boltless.configuration.default_db,
|
156
156
|
raw_results: false)
|
@@ -196,7 +196,7 @@ module Boltless
|
|
196
196
|
# @raise [Mixed] when an exception occurs inside the user given
|
197
197
|
# block, we re-raise it
|
198
198
|
#
|
199
|
-
# rubocop:disable Metrics/MethodLength because this is the workflow
|
199
|
+
# rubocop:disable Metrics/MethodLength -- because this is the workflow
|
200
200
|
def transaction!(access_mode = :write,
|
201
201
|
database: Boltless.configuration.default_db,
|
202
202
|
raw_results: false)
|
@@ -251,7 +251,7 @@ module Boltless
|
|
251
251
|
# @raise [Mixed] when an exception occurs inside the user given
|
252
252
|
# block, we re-raise it
|
253
253
|
#
|
254
|
-
# rubocop:disable Metrics/MethodLength because this is the workflow
|
254
|
+
# rubocop:disable Metrics/MethodLength -- because this is the workflow
|
255
255
|
def transaction(access_mode = :write,
|
256
256
|
database: Boltless.configuration.default_db,
|
257
257
|
raw_results: false)
|
@@ -4,8 +4,8 @@ module Boltless
|
|
4
4
|
module Extensions
|
5
5
|
# A top-level gem-module extension add helpers and utilites.
|
6
6
|
#
|
7
|
-
# rubocop:disable Metrics/BlockLength because this is how
|
8
|
-
#
|
7
|
+
# rubocop:disable Metrics/BlockLength -- because this is how an
|
8
|
+
# +ActiveSupport::Concern+ looks like
|
9
9
|
module Utilities
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
@@ -39,9 +39,9 @@ module Boltless
|
|
39
39
|
# template
|
40
40
|
# @return [String] the built Cypher query
|
41
41
|
#
|
42
|
-
# rubocop:disable Metrics/MethodLength because of the various
|
42
|
+
# rubocop:disable Metrics/MethodLength -- because of the various
|
43
43
|
# replacement strategies
|
44
|
-
# rubocop:disable Metrics/AbcSize
|
44
|
+
# rubocop:disable Metrics/AbcSize -- ditto
|
45
45
|
def build_cypher(**replacements)
|
46
46
|
# Process the given replacements in order to prevent Cypher
|
47
47
|
# injections from user given values
|
@@ -157,7 +157,7 @@ module Boltless
|
|
157
157
|
# @param cypher [String] the Cypher query to check
|
158
158
|
# @return [Symbol] the ANSI color name
|
159
159
|
#
|
160
|
-
# rubocop:disable Metrics/CyclomaticComplexity because of the
|
160
|
+
# rubocop:disable Metrics/CyclomaticComplexity -- because of the
|
161
161
|
# various conditions
|
162
162
|
def cypher_logging_color(cypher)
|
163
163
|
cypher = cypher.to_s.downcase.lines.map(&:strip)
|
data/lib/boltless/request.rb
CHANGED
@@ -5,8 +5,8 @@ module Boltless
|
|
5
5
|
# persistent connection for its whole runtime. This connection is strictly
|
6
6
|
# owned by a single request object. It is not safe to share it.
|
7
7
|
#
|
8
|
-
# rubocop:disable Metrics/ClassLength because of the isolated
|
9
|
-
#
|
8
|
+
# rubocop:disable Metrics/ClassLength -- because of the isolated request
|
9
|
+
# abstraction
|
10
10
|
class Request
|
11
11
|
class << self
|
12
12
|
# Convert a multiple Cypher queries and +Hash+ arguments into multiple
|
@@ -102,9 +102,9 @@ module Boltless
|
|
102
102
|
# @raise [Errors::TransactionBeginError] when we fail to start a
|
103
103
|
# new transaction
|
104
104
|
#
|
105
|
-
# rubocop:disable Metrics/MethodLength because of the error
|
106
|
-
#
|
107
|
-
# rubocop:disable Metrics/AbcSize
|
105
|
+
# rubocop:disable Metrics/MethodLength -- because of the error handlings
|
106
|
+
# and transaction identifier parsing
|
107
|
+
# rubocop:disable Metrics/AbcSize -- ditto
|
108
108
|
def begin_transaction
|
109
109
|
log_query(:begin, Request.statement_payload('BEGIN')) do
|
110
110
|
handle_transport_errors do
|
@@ -234,9 +234,9 @@ module Boltless
|
|
234
234
|
# error in the response, so we assume the transaction was rolled back
|
235
235
|
# by neo4j
|
236
236
|
#
|
237
|
-
# rubocop:disable Metrics/MethodLength because of the result
|
238
|
-
#
|
239
|
-
# rubocop:disable Metrics/AbcSize
|
237
|
+
# rubocop:disable Metrics/MethodLength -- because of the result handling
|
238
|
+
# (error, raw result, restructured result)
|
239
|
+
# rubocop:disable Metrics/AbcSize -- ditto
|
240
240
|
def handle_response_body(res, tx_id: nil)
|
241
241
|
# Parse the response body as a whole, which is returned by
|
242
242
|
# the configured raw response handler
|
@@ -306,8 +306,8 @@ module Boltless
|
|
306
306
|
# @yield the given user block
|
307
307
|
# @return [Mixed] the result of the user given block
|
308
308
|
#
|
309
|
-
# rubocop:disable Metrics/MethodLength because of the
|
310
|
-
#
|
309
|
+
# rubocop:disable Metrics/MethodLength -- because of the configuration
|
310
|
+
# handling
|
311
311
|
def log_query(tx_id, *statements)
|
312
312
|
# When no query logging is enabled, we won't do it
|
313
313
|
enabled = Boltless.configuration.query_log_enabled
|
@@ -357,9 +357,9 @@ module Boltless
|
|
357
357
|
# @param statements [Array<Hash>] the Cypher statements to run
|
358
358
|
# @return [String] the assembled logging string
|
359
359
|
#
|
360
|
-
# rubocop:disable Metrics/MethodLength because of the complex
|
361
|
-
#
|
362
|
-
# rubocop:disable Metrics/AbcSize
|
360
|
+
# rubocop:disable Metrics/MethodLength -- because of the complex logging
|
361
|
+
# string assembling/formatting
|
362
|
+
# rubocop:disable Metrics/AbcSize -- ditto
|
363
363
|
def generate_log_str(tx_id, duration, *statements)
|
364
364
|
dur = "(#{duration}ms)".colorize(color: :magenta, mode: :bold) \
|
365
365
|
if duration
|
data/lib/boltless/result.rb
CHANGED
@@ -65,9 +65,9 @@ module Boltless
|
|
65
65
|
#
|
66
66
|
# @param pp [PP] a pretty printer instance to use
|
67
67
|
#
|
68
|
-
# rubocop:disable Metrics/MethodLength because of the pretty
|
69
|
-
#
|
70
|
-
# rubocop:disable Metrics/AbcSize
|
68
|
+
# rubocop:disable Metrics/MethodLength -- because of the pretty printing
|
69
|
+
# logic
|
70
|
+
# rubocop:disable Metrics/AbcSize -- ditto
|
71
71
|
def pretty_print(pp)
|
72
72
|
pp.object_group(self) do
|
73
73
|
pp.breakable
|
data/lib/boltless/result_row.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
module Boltless
|
4
4
|
# A lightweight result row, used for convenient result data access.
|
5
5
|
#
|
6
|
-
# rubocop:disable Lint/StructNewOverride because we have an
|
7
|
-
#
|
6
|
+
# rubocop:disable Lint/StructNewOverride -- because we have an own
|
7
|
+
# implementation for +#values+
|
8
8
|
ResultRow = Struct.new(:result, :values, :meta, :graph) do
|
9
9
|
# A simple shortcut to easily access the row columns
|
10
10
|
delegate :columns, to: :result
|
data/lib/boltless/version.rb
CHANGED
@@ -23,7 +23,7 @@ RSpec.describe Boltless::Extensions::ConnectionPool do
|
|
23
23
|
Base64.decode64(options.headers['Authorization'].split.last).split(':')
|
24
24
|
end
|
25
25
|
|
26
|
-
# rubocop:disable RSpec/IdenticalEqualityAssertion because we want to
|
26
|
+
# rubocop:disable RSpec/IdenticalEqualityAssertion -- because we want to
|
27
27
|
# check for a memoized result
|
28
28
|
it 'returns a memoized connection pool instance' do
|
29
29
|
expect(described_class.connection_pool).to \
|
@@ -292,9 +292,9 @@ RSpec.describe Boltless::Extensions::Transactions do
|
|
292
292
|
end
|
293
293
|
|
294
294
|
context 'with intermediate results' do
|
295
|
-
# rubocop:disable RSpec/MultipleExpectations because of the
|
296
|
-
#
|
297
|
-
# rubocop:disable RSpec/ExampleLength
|
295
|
+
# rubocop:disable RSpec/MultipleExpectations -- because of the in-block
|
296
|
+
# testing
|
297
|
+
# rubocop:disable RSpec/ExampleLength -- ditto
|
298
298
|
it 'allows direct access to each result' do
|
299
299
|
Boltless.transaction! do |tx|
|
300
300
|
cypher, args = fetch_date_statement
|
@@ -399,9 +399,9 @@ RSpec.describe Boltless::Extensions::Transactions do
|
|
399
399
|
end
|
400
400
|
|
401
401
|
context 'with intermediate results' do
|
402
|
-
# rubocop:disable RSpec/MultipleExpectations because of the
|
403
|
-
#
|
404
|
-
# rubocop:disable RSpec/ExampleLength
|
402
|
+
# rubocop:disable RSpec/MultipleExpectations -- because of the in-block
|
403
|
+
# testing
|
404
|
+
# rubocop:disable RSpec/ExampleLength -- ditto
|
405
405
|
it 'allows direct access to each result' do
|
406
406
|
Boltless.transaction do |tx|
|
407
407
|
cypher, args = fetch_date_statement
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
# rubocop:disable RSpec/NestedGroups because nesting makes sense here
|
5
|
+
# rubocop:disable RSpec/NestedGroups -- because nesting makes sense here
|
6
6
|
RSpec.describe Boltless::Request do
|
7
7
|
let(:new_instance) { ->(**args) { described_class.new(connection, **args) } }
|
8
8
|
let(:instance) { new_instance.call }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boltless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hermann Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|