rom-sql 3.3.0 → 3.5.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 +4 -4
- data/CHANGELOG.md +53 -0
- data/lib/rom/plugins/relation/sql/postgres/streaming.rb +11 -0
- data/lib/rom/sql/extensions/postgres.rb +0 -1
- data/lib/rom/sql/extensions/postgres/commands.rb +6 -1
- data/lib/rom/sql/function.rb +13 -8
- data/lib/rom/sql/relation/reading.rb +12 -0
- data/lib/rom/sql/version.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: 72190a3c5b2df9cf0bc5db0ba2a4cae185f88e87dfa9ad7d0f7cf3967c1fe048
|
4
|
+
data.tar.gz: acd353e5348e8c797275829dacfedb445289e5e76d636df4b5cb7b40c1f48e7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93bc3e2cb1873865a886d221d34ff164a7d83de2ddaec4f6f3d99daf65465a14ded348c546151ae9d44e6eae6ca4dded468cc7386ff4513d6b02bab843485f14
|
7
|
+
data.tar.gz: 6c45fd11d745c05d1f536700c1cb246dd358e09668a406377281486b3d062c366db847dea96e457170e518e104baf64bb296f41613dd0099b5ffb7e839cd7679
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,58 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 3.5.0 2021-03-26
|
4
|
+
|
5
|
+
|
6
|
+
### Fixed
|
7
|
+
|
8
|
+
- Restored the fix for #390 that was lost by an accident in 3.3.3 and 3.4.0 (@solnic)
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Support for using partial indixes in PG upsert commands (issue #394 fixed via #395) (@smaximov)
|
13
|
+
|
14
|
+
[Compare v3.4.0...v3.5.0](https://github.com/rom-rb/rom-sql/compare/v3.4.0...v3.5.0)
|
15
|
+
|
16
|
+
## 3.4.0 2021-03-19
|
17
|
+
|
18
|
+
|
19
|
+
### Added
|
20
|
+
|
21
|
+
- `Relation#unordered` (@radar)
|
22
|
+
|
23
|
+
|
24
|
+
[Compare v3.3.3...v3.4.0](https://github.com/rom-rb/rom-sql/compare/v3.3.3...v3.4.0)
|
25
|
+
|
26
|
+
## 3.3.3 2021-03-05
|
27
|
+
|
28
|
+
|
29
|
+
### Added
|
30
|
+
|
31
|
+
- Support for streaming composite relations (@ianks)
|
32
|
+
|
33
|
+
|
34
|
+
[Compare v3.3.2...v3.3.3](https://github.com/rom-rb/rom-sql/compare/v3.3.2...v3.3.3)
|
35
|
+
|
36
|
+
## 3.3.2 2021-01-06
|
37
|
+
|
38
|
+
|
39
|
+
### Fixed
|
40
|
+
|
41
|
+
- Function qualification methods no longer lose options (issue #390 fixed via #391) (@solnic)
|
42
|
+
|
43
|
+
|
44
|
+
[Compare v3.3.1...v3.3.2](https://github.com/rom-rb/rom-sql/compare/v3.3.1...v3.3.2)
|
45
|
+
|
46
|
+
## 3.3.1 2020-12-29
|
47
|
+
|
48
|
+
|
49
|
+
### Fixed
|
50
|
+
|
51
|
+
- `:pg_streaming` plugin no longer crashes when there's no sequel_pg and now you need to require the plugin explicitly (@solnic)
|
52
|
+
|
53
|
+
|
54
|
+
[Compare v3.3.0...v3.3.1](https://github.com/rom-rb/rom-sql/compare/v3.3.0...v3.3.1)
|
55
|
+
|
3
56
|
## 3.3.0 2020-12-28
|
4
57
|
|
5
58
|
|
@@ -36,6 +36,7 @@ module ROM
|
|
36
36
|
def self.included(klass)
|
37
37
|
super
|
38
38
|
ROM::Relation::Graph.include(Combined)
|
39
|
+
ROM::Relation::Composite.include(Composite)
|
39
40
|
end
|
40
41
|
|
41
42
|
if defined?(JRUBY_VERSION)
|
@@ -82,6 +83,16 @@ module ROM
|
|
82
83
|
raise StreamingNotSupportedError, "not supported on combined relations"
|
83
84
|
end
|
84
85
|
end
|
86
|
+
|
87
|
+
module Composite
|
88
|
+
def stream_each
|
89
|
+
return to_enum unless block_given?
|
90
|
+
|
91
|
+
left.stream_each do |tuple|
|
92
|
+
yield right.call([tuple]).first
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
85
96
|
end
|
86
97
|
end
|
87
98
|
end
|
@@ -6,4 +6,3 @@ require 'rom/sql/extensions/postgres/type_builder'
|
|
6
6
|
require 'rom/sql/extensions/postgres/type_serializer'
|
7
7
|
require 'rom/plugins/relation/sql/postgres/explain'
|
8
8
|
require 'rom/plugins/relation/sql/postgres/full_text_search'
|
9
|
-
require "rom/plugins/relation/sql/postgres/streaming"
|
@@ -85,7 +85,7 @@ module ROM
|
|
85
85
|
class Upsert < SQL::Commands::Create
|
86
86
|
adapter :sql
|
87
87
|
|
88
|
-
defines :constraint, :conflict_target, :update_statement, :update_where
|
88
|
+
defines :constraint, :conflict_target, :conflict_where, :update_statement, :update_where
|
89
89
|
|
90
90
|
# @!attribute [r] constraint
|
91
91
|
# @return [Symbol] the name of the constraint expected to be violated
|
@@ -95,6 +95,10 @@ module ROM
|
|
95
95
|
# @return [Object] the column or expression to handle a violation on
|
96
96
|
option :conflict_target, default: -> { self.class.conflict_target }
|
97
97
|
|
98
|
+
# @!attribute [r] conflict_where
|
99
|
+
# @return [Object] the index filter, when using a partial index to determine uniqueness
|
100
|
+
option :conflict_where, default: -> { self.class.conflict_where }
|
101
|
+
|
98
102
|
# @!attribute [r] update_statement
|
99
103
|
# @return [Object] the update statement which will be executed in case of a violation
|
100
104
|
option :update_statement, default: -> { self.class.update_statement }
|
@@ -123,6 +127,7 @@ module ROM
|
|
123
127
|
@upsert_options ||= {
|
124
128
|
constraint: constraint,
|
125
129
|
target: conflict_target,
|
130
|
+
conflict_where: conflict_where,
|
126
131
|
update_where: update_where,
|
127
132
|
update: update_statement
|
128
133
|
}
|
data/lib/rom/sql/function.rb
CHANGED
@@ -73,18 +73,23 @@ module ROM
|
|
73
73
|
#
|
74
74
|
# @api private
|
75
75
|
def qualified(table_alias = nil)
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
new { |arg|
|
77
|
+
arg.respond_to?(:qualified) ? arg.qualified(table_alias) : arg
|
78
|
+
}
|
79
79
|
end
|
80
80
|
|
81
81
|
# @see Attribute#qualified_projection
|
82
82
|
#
|
83
83
|
# @api private
|
84
84
|
def qualified_projection(table_alias = nil)
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
new { |arg|
|
86
|
+
arg.respond_to?(:qualified_projection) ? arg.qualified_projection(table_alias) : arg
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
# @api private
|
91
|
+
def new(&block)
|
92
|
+
meta(func: ::Sequel::SQL::Function.new!(func.name, func.args.map(&block), func.opts))
|
88
93
|
end
|
89
94
|
|
90
95
|
# @see Attribute#qualified?
|
@@ -192,8 +197,8 @@ module ROM
|
|
192
197
|
# Filter aggregate using the specified conditions
|
193
198
|
#
|
194
199
|
# @example
|
195
|
-
# users.project { integer::count(:id).filter(name.is("Jack")).as(:jacks) }.
|
196
|
-
# users.project { integer::count(:id).filter { name.is("John") }).as(:johns) }.
|
200
|
+
# users.project { integer::count(:id).filter(name.is("Jack")).as(:jacks) }.unordered
|
201
|
+
# users.project { integer::count(:id).filter { name.is("John") }).as(:johns) }.ordered
|
197
202
|
#
|
198
203
|
# @param condition [Hash,SQL::Attribute] Conditions
|
199
204
|
# @yield [block] A block with restrictions
|
@@ -481,6 +481,18 @@ module ROM
|
|
481
481
|
end
|
482
482
|
end
|
483
483
|
|
484
|
+
# Removes ordering for the relation
|
485
|
+
#
|
486
|
+
# @example
|
487
|
+
# users.unordered
|
488
|
+
#
|
489
|
+
# @return [Relation]
|
490
|
+
#
|
491
|
+
# @api public
|
492
|
+
def unordered
|
493
|
+
new(dataset.unordered)
|
494
|
+
end
|
495
|
+
|
484
496
|
# Reverse the order of the relation
|
485
497
|
#
|
486
498
|
# @example
|
data/lib/rom/sql/version.rb
CHANGED
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.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|