click_house 1.2.7 → 1.3.0

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: 51b0ca346ad1346979535a0824660870e242190fe29290ffead5e86176aa33d8
4
- data.tar.gz: 9abff05f31db9370d318a6641d7ac5f5e285b887e5a962248021e26e5cf04b81
3
+ metadata.gz: 73a7b3a1d277214b437bf34712185e436d372a6396d0e388a446e3f29c61ac0e
4
+ data.tar.gz: 42869ca836d053d80299126149dc88266da4a0b31ce96837fc02348d60dc0394
5
5
  SHA512:
6
- metadata.gz: cc743a762b55addf1529d62977c2e8a31863433e42f7af8d35cb13be62a0d8bdf6aaf6dddcadee31bfea829027cc304bcff84334e4374fc1b3253b0ed3bf5eae
7
- data.tar.gz: e4797984cb3ea107d6772819c96204b6517bfba908b2f52b595a340eb474b7ebb655999f960e37f32eb383d7a62b1b81592764599cf20165fa5965aa140d49dc
6
+ metadata.gz: 5e308c6f52fc984e3532453a869603d727620d3db61533ff80307caa06c481a5dec29685c38fb46527dea94e9d3577ee5c8918af79aa85bd8697ae7a22063b26
7
+ data.tar.gz: 9dc3e6b31f65c6b3cee80aaa657fe924face07474d256714da34d4287128a26563a463e7b14019564895d4d6821b5b2aaf7324418530fd8c548d629522f15008
@@ -171,6 +171,16 @@ Style/RedundantAssignment:
171
171
  Enabled: true
172
172
  Style/RedundantFileExtensionInRequire:
173
173
  Enabled: true
174
+ Style/ExplicitBlockArgument:
175
+ Enabled: true
176
+ Style/GlobalStdStream:
177
+ Enabled: true
178
+ Style/OptionalBooleanParameter:
179
+ Enabled: true
180
+ Style/SingleArgumentDig:
181
+ Enabled: true
182
+ Style/StringConcatenation:
183
+ Enabled: true
174
184
 
175
185
  # ============================== Lint ==============================
176
186
  Lint/DuplicateMethods:
@@ -187,3 +197,21 @@ Lint/StructNewOverride:
187
197
  Enabled: true
188
198
  Lint/DuplicateElsifCondition:
189
199
  Enabled: true
200
+ Lint/BinaryOperatorWithIdenticalOperands:
201
+ Enabled: true
202
+ Lint/DuplicateRescueException:
203
+ Enabled: true
204
+ Lint/EmptyConditionalBody:
205
+ Enabled: true
206
+ Lint/FloatComparison:
207
+ Enabled: true
208
+ Lint/MissingSuper:
209
+ Enabled: false
210
+ Lint/OutOfRangeRegexpRef:
211
+ Enabled: true
212
+ Lint/SelfAssignment:
213
+ Enabled: true
214
+ Lint/TopLevelReturnWithArgument:
215
+ Enabled: true
216
+ Lint/UnreachableLoop:
217
+ Enabled: true
@@ -1,3 +1,6 @@
1
+ # 1.3.0
2
+ * added support for IPv4/IPv6 types
3
+
1
4
  # 1.2.7
2
5
  * rubocop version bump
3
6
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- click_house (1.2.6)
4
+ click_house (1.3.0)
5
5
  faraday
6
6
  faraday_middleware
7
7
 
@@ -40,13 +40,13 @@ GEM
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
41
  rspec-support (~> 3.9.0)
42
42
  rspec-support (3.9.3)
43
- rubocop (0.88.0)
43
+ rubocop (0.89.1)
44
44
  parallel (~> 1.10)
45
45
  parser (>= 2.7.1.1)
46
46
  rainbow (>= 2.2.2, < 4.0)
47
47
  regexp_parser (>= 1.7)
48
48
  rexml
49
- rubocop-ast (>= 0.1.0, < 1.0)
49
+ rubocop-ast (>= 0.3.0, < 1.0)
50
50
  ruby-progressbar (~> 1.7)
51
51
  unicode-display_width (>= 1.4.0, < 2.0)
52
52
  rubocop-ast (0.3.0)
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Gem Version](https://badge.fury.io/rb/click_house.svg)](https://badge.fury.io/rb/click_house)
8
8
 
9
9
  ```bash
10
- # Requires modern Ruby (>= 2.5), tested with Yandex.Clickhouse v 19.16.2.2
10
+ # Requires modern Ruby (>= 2.5), tested with Yandex.Clickhouse v 20.9.2.20
11
11
  gem install click_house
12
12
  ```
13
13
 
@@ -449,8 +449,8 @@ class CreateAdvertVisits < ActiveRecord::Migration[6.0]
449
449
  t.UInt16 :user_id
450
450
  t.Date :date
451
451
  t.DateTime :time, 'UTC'
452
- t.UInt32 :ipv4
453
- t.UInt64 :ipv6
452
+ t.IPv4 :ipv4
453
+ t.IPv6 :ipv6
454
454
  t.UInt32 :device_type_id
455
455
  t.UInt32 :os_family_id
456
456
  end
@@ -2,7 +2,7 @@ version: '3.5'
2
2
 
3
3
  services:
4
4
  clickhouse:
5
- image: yandex/clickhouse-server:20.5.4.40
5
+ image: yandex/clickhouse-server:20.9.2.20
6
6
  ports:
7
7
  - "8123:8123"
8
8
  - "9000:9000"
@@ -60,4 +60,9 @@ module ClickHouse
60
60
  add_type column, Type::FloatType.new
61
61
  add_type "Nullable(#{column})", Type::NullableType.new(Type::IntegerType.new)
62
62
  end
63
+
64
+ %w[IPv4 IPv6].each do |column|
65
+ add_type column, Type::IPType.new
66
+ add_type "Nullable(#{column})", Type::NullableType.new(Type::IPType.new)
67
+ end
63
68
  end
@@ -11,6 +11,7 @@ module ClickHouse
11
11
  'FixedString(%d)',
12
12
  'UUID',
13
13
  'Date',
14
+ 'IPv4', 'IPv6',
14
15
  "DateTime('%s')", "DateTime64(%d, '%s')"
15
16
  ].freeze
16
17
 
@@ -15,5 +15,6 @@ module ClickHouse
15
15
  autoload :FixedStringType, 'click_house/type/fixed_string_type'
16
16
  autoload :ArrayType, 'click_house/type/array_type'
17
17
  autoload :StringType, 'click_house/type/string_type'
18
+ autoload :IPType, 'click_house/type/ip_type'
18
19
  end
19
20
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ClickHouse
4
+ module Type
5
+ class IPType < BaseType
6
+ def cast(value)
7
+ IPAddr.new(value) unless value.nil?
8
+ end
9
+
10
+ def serialize(value)
11
+ value.to_s unless value.nil?
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClickHouse
4
- VERSION = '1.2.7'
4
+ VERSION = '1.3.0'
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.7
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliaksandr Shylau
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2020-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -181,6 +181,7 @@ files:
181
181
  - lib/click_house/type/fixed_string_type.rb
182
182
  - lib/click_house/type/float_type.rb
183
183
  - lib/click_house/type/integer_type.rb
184
+ - lib/click_house/type/ip_type.rb
184
185
  - lib/click_house/type/nullable_type.rb
185
186
  - lib/click_house/type/string_type.rb
186
187
  - lib/click_house/type/undefined_type.rb