click_house 1.2.2 → 1.2.7

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: 4819eadc5f15e518ec76343f471e7e792e07323e1a390fdc9cea34f15fbd329c
4
- data.tar.gz: 80849b1ae3da0359031a0e0d7e2e4d31071c03a7f48142e8c236e4a440534c05
3
+ metadata.gz: 51b0ca346ad1346979535a0824660870e242190fe29290ffead5e86176aa33d8
4
+ data.tar.gz: 9abff05f31db9370d318a6641d7ac5f5e285b887e5a962248021e26e5cf04b81
5
5
  SHA512:
6
- metadata.gz: c785b30094baab0ba6a465eea9e02e0540b36b76b743dd456f2ed26b93510b38fde5b0a986e6e98880dc1527146c525d4de7a907404cbe6149f69c47f993fab3
7
- data.tar.gz: f89cdef75b3bdf93b90359f170d55e143710d9797db9138b99ff943af5a0e0718c6858c49210fccbd044b825875d7fec4dc3540aa70db8ab0939bfd95c80a814
6
+ metadata.gz: cc743a762b55addf1529d62977c2e8a31863433e42f7af8d35cb13be62a0d8bdf6aaf6dddcadee31bfea829027cc304bcff84334e4374fc1b3253b0ed3bf5eae
7
+ data.tar.gz: e4797984cb3ea107d6772819c96204b6517bfba908b2f52b595a340eb474b7ebb655999f960e37f32eb383d7a62b1b81592764599cf20165fa5965aa140d49dc
@@ -8,7 +8,7 @@ AllCops:
8
8
  - 'bin/*'
9
9
  - 'spec/**/*'
10
10
  - 'vendor/**/*'
11
- TargetRubyVersion: 2.6.5
11
+ TargetRubyVersion: 2.7
12
12
 
13
13
  Bundler/OrderedGems:
14
14
  Enabled: false
@@ -17,6 +17,24 @@ Bundler/OrderedGems:
17
17
  Style/Documentation:
18
18
  Enabled: false
19
19
 
20
+ # =============================== Performance =======================
21
+ Performance/AncestorsInclude:
22
+ Enabled: true
23
+ Performance/BigDecimalWithNumericArgument:
24
+ Enabled: true
25
+ Performance/RedundantSortBlock:
26
+ Enabled: true
27
+ Performance/RedundantStringChars:
28
+ Enabled: true
29
+ Performance/ReverseFirst:
30
+ Enabled: true
31
+ Performance/SortReverse:
32
+ Enabled: true
33
+ Performance/Squeeze:
34
+ Enabled: true
35
+ Performance/StringInclude:
36
+ Enabled: true
37
+
20
38
  # ============================== Metrics ============================
21
39
  Metrics/ClassLength:
22
40
  Max: 180
@@ -31,22 +49,22 @@ Metrics/AbcSize:
31
49
 
32
50
  # ============================== Naming =============================
33
51
  Naming/PredicateName:
34
- NamePrefixBlacklist:
52
+ ForbiddenPrefixes:
35
53
  - is_
36
54
  Naming/FileName:
37
55
  Enabled: true
38
56
  Exclude:
39
57
  - 'Gemfile'
40
- Naming/UncommunicativeMethodParamName:
58
+ Naming/MethodParameterName:
41
59
  Enabled: false
42
60
  Naming/AccessorMethodName:
43
61
  Enabled: false
44
62
 
45
63
  # ============================== Layout =============================
46
- Layout/AlignHash:
64
+ Layout/HashAlignment:
47
65
  EnforcedHashRocketStyle: key
48
66
  EnforcedColonStyle: key
49
- Layout/AlignParameters:
67
+ Layout/ParameterAlignment:
50
68
  EnforcedStyle: with_fixed_indentation
51
69
  Layout/CaseIndentation:
52
70
  EnforcedStyle: case
@@ -65,12 +83,16 @@ Layout/EmptyLinesAroundBlockBody:
65
83
  Enabled: true
66
84
  Layout/EndAlignment:
67
85
  EnforcedStyleAlignWith: variable
68
- Layout/IndentFirstHashElement:
86
+ Layout/FirstHashElementIndentation:
69
87
  EnforcedStyle: consistent
70
- Layout/IndentHeredoc:
88
+ Layout/HeredocIndentation:
71
89
  Enabled: false
72
90
  Layout/RescueEnsureAlignment:
73
91
  Enabled: false
92
+ Layout/EmptyLinesAroundAttributeAccessor:
93
+ Enabled: true
94
+ Layout/SpaceAroundMethodCallOperator:
95
+ Enabled: true
74
96
 
75
97
  # ============================== Style ==============================
76
98
  Style/RescueModifier:
@@ -117,9 +139,51 @@ Style/GuardClause:
117
139
  Enabled: false
118
140
  Style/TrailingCommaInHashLiteral:
119
141
  Enabled: false
142
+ Style/ExponentialNotation:
143
+ Enabled: true
144
+ Style/HashEachMethods:
145
+ Enabled: true
146
+ Style/HashTransformKeys:
147
+ Enabled: true
148
+ Style/HashTransformValues:
149
+ Enabled: true
150
+ Style/RedundantFetchBlock:
151
+ Enabled: true
152
+ Style/RedundantRegexpCharacterClass:
153
+ Enabled: true
154
+ Style/RedundantRegexpEscape:
155
+ Enabled: true
156
+ Style/SlicingWithRange:
157
+ Enabled: true
158
+ Style/AccessorGrouping:
159
+ Enabled: false
160
+ Style/ArrayCoercion:
161
+ Enabled: true
162
+ Style/BisectedAttrAccessor:
163
+ Enabled: true
164
+ Style/CaseLikeIf:
165
+ Enabled: true
166
+ Style/HashAsLastArrayItem:
167
+ Enabled: true
168
+ Style/HashLikeCase:
169
+ Enabled: true
170
+ Style/RedundantAssignment:
171
+ Enabled: true
172
+ Style/RedundantFileExtensionInRequire:
173
+ Enabled: true
120
174
 
121
175
  # ============================== Lint ==============================
122
176
  Lint/DuplicateMethods:
123
177
  Enabled: false
124
178
  Lint/AmbiguousOperator:
125
179
  Enabled: false
180
+ Lint/DeprecatedOpenSSLConstant:
181
+ Enabled: true
182
+ Lint/MixedRegexpCaptureTypes:
183
+ Enabled: true
184
+ Lint/RaiseException:
185
+ Enabled: true
186
+ Lint/StructNewOverride:
187
+ Enabled: true
188
+ Lint/DuplicateElsifCondition:
189
+ Enabled: true
@@ -0,0 +1,5 @@
1
+ # 1.2.7
2
+ * rubocop version bump
3
+
4
+ # 1.2.6
5
+ * Datetime64 field type support [#3](https://github.com/shlima/click_house/pull/3)
@@ -1,67 +1,72 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- click_house (1.2.2)
4
+ click_house (1.2.6)
5
5
  faraday
6
6
  faraday_middleware
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ast (2.4.0)
12
- coderay (1.1.2)
13
- diff-lcs (1.3)
14
- faraday (0.17.0)
11
+ ast (2.4.1)
12
+ coderay (1.1.3)
13
+ diff-lcs (1.4.4)
14
+ faraday (1.0.1)
15
15
  multipart-post (>= 1.2, < 3)
16
- faraday_middleware (0.13.1)
17
- faraday (>= 0.7.4, < 1.0)
18
- jaro_winkler (1.5.4)
19
- method_source (0.9.2)
16
+ faraday_middleware (1.0.0)
17
+ faraday (~> 1.0)
18
+ method_source (1.0.0)
20
19
  multipart-post (2.1.1)
21
- parallel (1.18.0)
22
- parser (2.6.5.0)
23
- ast (~> 2.4.0)
24
- pry (0.12.2)
25
- coderay (~> 1.1.0)
26
- method_source (~> 0.9.0)
20
+ parallel (1.19.2)
21
+ parser (2.7.1.4)
22
+ ast (~> 2.4.1)
23
+ pry (0.13.1)
24
+ coderay (~> 1.1)
25
+ method_source (~> 1.0)
27
26
  rainbow (3.0.0)
28
- rake (13.0.0)
27
+ rake (13.0.1)
28
+ regexp_parser (1.7.1)
29
+ rexml (3.2.4)
29
30
  rspec (3.9.0)
30
31
  rspec-core (~> 3.9.0)
31
32
  rspec-expectations (~> 3.9.0)
32
33
  rspec-mocks (~> 3.9.0)
33
- rspec-core (3.9.0)
34
- rspec-support (~> 3.9.0)
35
- rspec-expectations (3.9.0)
34
+ rspec-core (3.9.2)
35
+ rspec-support (~> 3.9.3)
36
+ rspec-expectations (3.9.2)
36
37
  diff-lcs (>= 1.2.0, < 2.0)
37
38
  rspec-support (~> 3.9.0)
38
- rspec-mocks (3.9.0)
39
+ rspec-mocks (3.9.1)
39
40
  diff-lcs (>= 1.2.0, < 2.0)
40
41
  rspec-support (~> 3.9.0)
41
- rspec-support (3.9.0)
42
- rubocop (0.76.0)
43
- jaro_winkler (~> 1.5.1)
42
+ rspec-support (3.9.3)
43
+ rubocop (0.88.0)
44
44
  parallel (~> 1.10)
45
- parser (>= 2.6)
45
+ parser (>= 2.7.1.1)
46
46
  rainbow (>= 2.2.2, < 4.0)
47
+ regexp_parser (>= 1.7)
48
+ rexml
49
+ rubocop-ast (>= 0.1.0, < 1.0)
47
50
  ruby-progressbar (~> 1.7)
48
- unicode-display_width (>= 1.4.0, < 1.7)
49
- rubocop-performance (1.5.0)
50
- rubocop (>= 0.71.0)
51
+ unicode-display_width (>= 1.4.0, < 2.0)
52
+ rubocop-ast (0.3.0)
53
+ parser (>= 2.7.1.4)
54
+ rubocop-performance (1.7.1)
55
+ rubocop (>= 0.82.0)
51
56
  ruby-progressbar (1.10.1)
52
- unicode-display_width (1.6.0)
57
+ unicode-display_width (1.7.0)
53
58
 
54
59
  PLATFORMS
55
60
  ruby
56
61
 
57
62
  DEPENDENCIES
58
- bundler (~> 1.17)
63
+ bundler
59
64
  click_house!
60
65
  pry
61
- rake (~> 13.0)
62
- rspec (~> 3.0)
66
+ rake
67
+ rspec
63
68
  rubocop
64
69
  rubocop-performance
65
70
 
66
71
  BUNDLED WITH
67
- 1.17.3
72
+ 2.1.4
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ COPYRIGHT (C) 2019 ALIAKSANDR SHYLAU
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -38,6 +38,9 @@ Yandex uses HTTP interface for working from Java and Perl, Python and Go as well
38
38
  * [Type casting](#type-casting)
39
39
  * [Using with a connection pool](#using-with-a-connection-pool)
40
40
  * [Using with Rails](#using-with-rails)
41
+ * [Using with ActiveRecord](#using-with-activerecord)
42
+ * [Using with RSpec](#using-with-rspec)
43
+ * [Development](#development)
41
44
 
42
45
  ## Configuration
43
46
 
@@ -73,7 +76,8 @@ Now you are able to communicate with ClickHouse:
73
76
  ```ruby
74
77
  ClickHouse.connection.ping #=> true
75
78
  ```
76
- You can easily build a new raw connection
79
+ You can easily build a new raw connection and override any configuration parameter
80
+ (such as database name, connection address)
77
81
 
78
82
  ```ruby
79
83
  @connection = ClickHouse::Connection.new(ClickHouse::Config.new(logger: Rails.logger))
@@ -175,6 +179,8 @@ response.body #=> "\u0002\u0000\u0000\u0000\u0000\u0000\u0000\u0000"
175
179
 
176
180
  ## Insert
177
181
 
182
+ When column names and values are transferred separately
183
+
178
184
  ```ruby
179
185
  ClickHouse.connection.insert('table', columns: %i[id name]) do |buffer|
180
186
  buffer << [1, 'Mercury']
@@ -185,6 +191,19 @@ ClickHouse.connection.insert('table', columns: %i[id name], values: [[1, 'Mercur
185
191
  #=> true
186
192
  ```
187
193
 
194
+ When rows are passed as a hash
195
+
196
+
197
+ ```ruby
198
+ ClickHouse.connection.insert('table', values: [{ name: 'Sun', id: 1 }, { name: 'Moon', id: 2 }])
199
+
200
+ ClickHouse.connection.insert('table') do |buffer|
201
+ buffer << { name: 'Sun', id: 1 }
202
+ buffer << { name: 'Moon', id: 2 }
203
+ end
204
+ #=> true
205
+ ```
206
+
188
207
  ## Create a table
189
208
  ### Create table using DSL
190
209
 
@@ -314,7 +333,15 @@ string_type = FixedStringType.new
314
333
 
315
334
  ClickHouse.connection.insert('table', columns: %i[name time]) do |buffer|
316
335
  buffer << [string_type.serialize('a' * 1000, 20), time.serialize(Time.current, 'Europe/Moscow')]
317
- end
336
+ end
337
+
338
+ ## alternatively
339
+ data = @records.map do |record|
340
+ {
341
+ id: record.id,
342
+ time: ClickHouse.types['DateTime(%s)'].serialize(Time.current)
343
+ }
344
+ end
318
345
  ```
319
346
 
320
347
  If native type supports arguments, define type with `%s` argument:
@@ -329,6 +356,15 @@ end
329
356
  ClickHouse.add_type('DateTime(%s)', DateTimeType.new)
330
357
  ```
331
358
 
359
+ if you need to redefine all built-in types with your implementation,
360
+ just clear the default type system:
361
+
362
+ ```ruby
363
+ ClickHouse.types.clear
364
+ ClickHouse.types # => {}
365
+ ClickHouse.types.default #=> #<ClickHouse::Type::UndefinedType:0x00007fc1cfabd630>
366
+ ```
367
+
332
368
  ## Using with a connection pool
333
369
 
334
370
  ```ruby
@@ -426,30 +462,69 @@ class CreateAdvertVisits < ActiveRecord::Migration[6.0]
426
462
  end
427
463
  ```
428
464
 
465
+ ## Using with ActiveRecord
466
+
429
467
  if you use `ActiveRecord`, you can use the ORM query builder by using fake models
468
+ (empty tables must be present in the SQL database `create_table :visits`)
469
+
470
+ ```ruby
471
+ class ClickHouseRecord < ActiveRecord::Base
472
+ self.abstract_class = true
473
+
474
+ class << self
475
+ def agent
476
+ ClickHouse.connection
477
+ end
478
+
479
+ def insert(*argv, &block)
480
+ agent.insert(table_name, *argv, &block)
481
+ end
482
+
483
+ def select_one
484
+ agent.select_one(current_scope.to_sql)
485
+ end
486
+
487
+ def select_value
488
+ agent.select_value(current_scope.to_sql)
489
+ end
490
+
491
+ def select_all
492
+ agent.select_all(current_scope.to_sql)
493
+ end
494
+ end
495
+ end
496
+ ````
430
497
 
431
498
  ````ruby
432
499
  # FAKE MODEL FOR ClickHouse
433
- class Visit < ApplicationRecord
500
+ class Visit < ClickHouseRecord
434
501
  scope :with_os, -> { where.not(os_family_id: nil) }
435
502
  end
436
503
 
437
- scope = Visit.with_os.select('COUNT(*) as counter').group(:ipv4)
438
- ClickHouse.connection.select_all(scope.to_sql)
504
+ Visit.with_os.select('COUNT(*) as counter').group(:ipv4).select_all
505
+ #=> [{ 'ipv4' => 1455869, 'counter' => 104 }]
506
+
507
+ Visit.with_os.select('COUNT(*)').select_value
508
+ #=> 20_345_678
509
+
510
+ Visit.where(user_id: 1).select_one
511
+ #=> { 'ipv4' => 1455869, 'user_id' => 1 }
439
512
  ````
440
513
 
514
+ ## Using with RSpec
515
+
441
516
  You can clear the data table before each test with RSpec
442
517
 
443
518
  ```ruby
444
519
  RSpec.configure do |config|
445
- config.before(:each, clean_click_house: true) do
520
+ config.before(:each, truncate_click_house: true) do
446
521
  ClickHouse.connection.truncate_tables
447
522
  end
448
523
  end
449
524
  ```
450
525
 
451
526
  ```ruby
452
- RSpec.describe Api::MetricsCountroller, clean_click_house: true do
527
+ RSpec.describe Api::MetricsCountroller, truncate_click_house: true do
453
528
  it { }
454
529
  it { }
455
530
  end
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency 'faraday'
24
24
  spec.add_dependency 'faraday_middleware'
25
- spec.add_development_dependency 'bundler', '~> 1.17'
26
- spec.add_development_dependency 'rake', '~> 13.0'
27
- spec.add_development_dependency 'rspec', '~> 3.0'
25
+ spec.add_development_dependency 'bundler'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'rspec'
28
28
  spec.add_development_dependency 'pry'
29
29
  spec.add_development_dependency 'rubocop'
30
30
  spec.add_development_dependency 'rubocop-performance'
@@ -2,7 +2,7 @@ version: '3.5'
2
2
 
3
3
  services:
4
4
  clickhouse:
5
- image: yandex/clickhouse-server
5
+ image: yandex/clickhouse-server:20.5.4.40
6
6
  ports:
7
7
  - "8123:8123"
8
8
  - "9000:9000"
@@ -41,6 +41,11 @@ module ClickHouse
41
41
  add_type "Nullable(#{column})", Type::NullableType.new(Type::DateTimeType.new)
42
42
  end
43
43
 
44
+ ['DateTime64(%d, %s)'].each do |column|
45
+ add_type column, Type::DateTime64Type.new
46
+ add_type "Nullable(#{column})", Type::NullableType.new(Type::DateTime64Type.new)
47
+ end
48
+
44
49
  ['Decimal(%s, %s)', 'Decimal32(%s)', 'Decimal64(%s)', 'Decimal128(%s)'].each do |column|
45
50
  add_type column, Type::DecimalType.new
46
51
  add_type "Nullable(#{column})", Type::NullableType.new(Type::DecimalType.new)
@@ -39,7 +39,7 @@ module ClickHouse
39
39
  def extension_type
40
40
  extensions.nil? ? type : format(type, *extensions)
41
41
  rescue TypeError, ArgumentError
42
- raise Exception, "please provide extensions for <#{type}>"
42
+ raise StandardError, "please provide extensions for <#{type}>"
43
43
  end
44
44
  end
45
45
  end
@@ -11,7 +11,7 @@ module ClickHouse
11
11
  'FixedString(%d)',
12
12
  'UUID',
13
13
  'Date',
14
- "DateTime('%s')"
14
+ "DateTime('%s')", "DateTime64(%d, '%s')"
15
15
  ].freeze
16
16
 
17
17
  class << self
@@ -3,13 +3,29 @@
3
3
  module ClickHouse
4
4
  module Extend
5
5
  module ConnectionInserting
6
- def insert(table, columns:, values: [])
6
+ EMPTY_INSERT = true
7
+
8
+ # @return [Boolean]
9
+ #
10
+ # == Example with a block
11
+ # insert('rspec', columns: %i[name id]) do |buffer|
12
+ # buffer << ['Sun', 1]
13
+ # buffer << ['Moon', 2]
14
+ # end
15
+ #
16
+ # == Example with a param
17
+ # subject.insert('rspec', values: [{ name: 'Sun', id: 1 }, { name: 'Moon', id: 2 }])
18
+ def insert(table, columns: [], values: [])
7
19
  yield(values) if block_given?
8
20
 
9
- body = values.map do |value_row|
10
- columns.zip(value_row).to_h.to_json
21
+ body = if columns.empty?
22
+ values.map(&:to_json)
23
+ else
24
+ values.map { |value_row| columns.zip(value_row).to_h.to_json }
11
25
  end
12
26
 
27
+ return EMPTY_INSERT if values.empty?
28
+
13
29
  execute("INSERT INTO #{table} FORMAT JSONEachRow", body.join("\n")).success?
14
30
  end
15
31
  end
@@ -26,7 +26,7 @@ module ClickHouse
26
26
  logger.level == Logger::DEBUG
27
27
  end
28
28
 
29
- # rubocop:disable Metrics/LineLength
29
+ # rubocop:disable Layout/LineLength
30
30
  def on_complete(env)
31
31
  summary = extract_summary(env.response_headers)
32
32
  elapsed = duration
@@ -36,7 +36,7 @@ module ClickHouse
36
36
  logger.debug(body) if body
37
37
  logger.info("\e[1mRead: #{summary.fetch(:read_rows)} rows, #{summary.fetch(:read_bytes)}. Written: #{summary.fetch(:written_rows)}, rows #{summary.fetch(:written_bytes)}\e[0m")
38
38
  end
39
- # rubocop:enable Metrics/LineLength
39
+ # rubocop:enable Layout/LineLength
40
40
 
41
41
  def duration
42
42
  timestamp - starting
@@ -7,6 +7,7 @@ module ClickHouse
7
7
  autoload :UndefinedType, 'click_house/type/undefined_type'
8
8
  autoload :DateType, 'click_house/type/date_type'
9
9
  autoload :DateTimeType, 'click_house/type/date_time_type'
10
+ autoload :DateTime64Type, 'click_house/type/date_time64_type'
10
11
  autoload :IntegerType, 'click_house/type/integer_type'
11
12
  autoload :FloatType, 'click_house/type/float_type'
12
13
  autoload :BooleanType, 'click_house/type/boolean_type'
@@ -3,11 +3,11 @@
3
3
  module ClickHouse
4
4
  module Type
5
5
  class BaseType
6
- def cast(_value)
6
+ def cast(_value, *)
7
7
  raise NotImplementedError, __method__
8
8
  end
9
9
 
10
- def serialize(_value)
10
+ def serialize(_value, *)
11
11
  raise NotImplementedError, __method__
12
12
  end
13
13
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ClickHouse
4
+ module Type
5
+ class DateTime64Type < BaseType
6
+ def cast(value, _precision = nil, tz = nil)
7
+ DateTime.parse("#{value} #{tz}")
8
+ end
9
+
10
+ def serialize(value, precision = 3)
11
+ value.strftime("%Y-%m-%d %H:%M:%S.%#{precision}N")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -8,7 +8,7 @@ module ClickHouse
8
8
  end
9
9
 
10
10
  def serialize(value)
11
- value.strftime('%Y-%m-%d %H:%m:%S %p %z')
11
+ value.strftime('%Y-%m-%d %H:%M:%S')
12
12
  end
13
13
  end
14
14
  end
@@ -13,8 +13,8 @@ module ClickHouse
13
13
  subtype.cast(*argv) unless argv.first.nil?
14
14
  end
15
15
 
16
- def serialize(value)
17
- value.nil ? 'NULL' : subtype.serialize(value)
16
+ def serialize(*argv)
17
+ subtype.serialize(*argv) unless argv.first.nil?
18
18
  end
19
19
  end
20
20
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ClickHouse
4
4
  module Type
5
- class UndefinedType
5
+ class UndefinedType < BaseType
6
6
  def cast(value, *)
7
7
  value
8
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClickHouse
4
- VERSION = '1.2.2'
4
+ VERSION = '1.2.7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: click_house
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliaksandr Shylau
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-11 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -42,44 +42,44 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.17'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.17'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '13.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '13.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -133,8 +133,10 @@ files:
133
133
  - ".rspec"
134
134
  - ".rubocop.yml"
135
135
  - ".travis.yml"
136
+ - CHANGELOG.md
136
137
  - Gemfile
137
138
  - Gemfile.lock
139
+ - LICENCE.txt
138
140
  - Makefile
139
141
  - README.md
140
142
  - Rakefile
@@ -172,6 +174,7 @@ files:
172
174
  - lib/click_house/type/array_type.rb
173
175
  - lib/click_house/type/base_type.rb
174
176
  - lib/click_house/type/boolean_type.rb
177
+ - lib/click_house/type/date_time64_type.rb
175
178
  - lib/click_house/type/date_time_type.rb
176
179
  - lib/click_house/type/date_type.rb
177
180
  - lib/click_house/type/decimal_type.rb
@@ -190,7 +193,7 @@ files:
190
193
  homepage: https://github.com/shlima/click_house
191
194
  licenses: []
192
195
  metadata: {}
193
- post_install_message:
196
+ post_install_message:
194
197
  rdoc_options: []
195
198
  require_paths:
196
199
  - lib
@@ -205,8 +208,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
208
  - !ruby/object:Gem::Version
206
209
  version: '0'
207
210
  requirements: []
208
- rubygems_version: 3.0.6
209
- signing_key:
211
+ rubygems_version: 3.1.2
212
+ signing_key:
210
213
  specification_version: 4
211
214
  summary: Modern Ruby database driver for ClickHouse
212
215
  test_files: []