rom-sql 3.6.0 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd16261df5aee3251449218ae148340eff0718a1fdc2da7ed15504810f4a0b57
4
- data.tar.gz: dc889208691825ead3b1bd5099d24cf102a2c62edfc92a5dff9a5a47a3dbebf5
3
+ metadata.gz: cc51c9abdc25fa792a3115391e4dbb169d8c7dba6bac5553810140013d097836
4
+ data.tar.gz: 9b96d61a4dbdb7fa422f66e04933f89c513e429d5576cb6ce5c3c41acec96649
5
5
  SHA512:
6
- metadata.gz: 9af6cf7c57dea4550c2ce843005315cbf8cea6222b5e2c8fba9061ba22082cb111d5623ef1183e11dd9f59426f5eb572bcc95781f4aa94df0bfa883310882f10
7
- data.tar.gz: ea1aadd57d67f6f6c3bbfa337e72e82817a9bc17475653b4d715e8a86068e3643a7c18f96840bec62c9af37fdd13badd3ed7687b5560b9e555dc593e874f1ac5
6
+ metadata.gz: 185d71f20d84f614f47511bd1f5f21fd03cfd5d6f0734431464cfa895bb5a1b263798becd891c26b54498c50970d73dcb43cda8c34b2a90a25ca5e164a3921e9
7
+ data.tar.gz: 57926f14bd364b7abbab21c5bb6d89a53989029e84540e88e9b3b4695abc60509d741884e52313e329f676cfb787ce53eeaf8519794672e75d60f66162bbfb9a
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
- ## 3.6.0
3
+ ## 3.6.1 2022-11-22
4
+
5
+ ### Fixed
6
+
7
+ - Mapping of cidr types in PostgreSQL to IPAddr values (@flash-gordon)
8
+
9
+ ## 3.6.0 2022-11-11
4
10
 
5
11
  ### Added
6
12
 
@@ -20,7 +20,7 @@ module ROM
20
20
  'jsonb' => Types::JSONB,
21
21
  'xml' => Types::XML,
22
22
  'inet' => Types::IPAddress,
23
- 'cidr' => Types::IPAddress,
23
+ 'cidr' => Types::IPNetwork,
24
24
  'macaddr' => SQL::Types::String,
25
25
  'point' => Types::Point,
26
26
  'hstore' => Types::HStore,
@@ -16,6 +16,7 @@ module ROM
16
16
  Types::JSONB => 'jsonb',
17
17
  Types::HStore => 'hstore',
18
18
  Types::IPAddress => 'inet',
19
+ Types::IPNetwork => 'cidr',
19
20
  Types::Point => 'point',
20
21
  Types::Line => 'line',
21
22
  Types::Circle => 'circle',
@@ -7,9 +7,22 @@ module ROM
7
7
  module Postgres
8
8
  module Types
9
9
  IPAddress = Type('inet') do
10
- read = SQL::Types.Constructor(IPAddr) { |ip| IPAddr.new(ip.to_s) }
10
+ read = SQL::Types.Constructor(IPAddr) { |ip| ::IPAddr.new(ip.to_s) }
11
11
 
12
- SQL::Types.Constructor(IPAddr, &:to_s).meta(read: read)
12
+ SQL::Types.Constructor(::IPAddr, &:to_s).meta(read: read)
13
+ end
14
+
15
+ IPNetwork = Type('cidr') do
16
+ read = SQL::Types.Constructor(IPAddr) do |ip|
17
+ case ip
18
+ when ::IPAddr
19
+ ip
20
+ when String
21
+ ::IPAddr.new(ip)
22
+ end
23
+ end
24
+
25
+ SQL::Types.Constructor(::IPAddr) { |ip| "#{ip}/#{ip.prefix}" }.meta(read: read)
13
26
  end
14
27
  end
15
28
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ROM
4
4
  module SQL
5
- VERSION = '3.6.0'.freeze
5
+ VERSION = '3.6.1'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-11 00:00:00.000000000 Z
11
+ date: 2022-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel