multi_insert 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/multi_insert/query.rb +3 -3
- data/lib/multi_insert/query_builder.rb +6 -2
- data/lib/multi_insert/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c1738f3565a4700e34dfe07e7a2e098f4ab386b
|
4
|
+
data.tar.gz: 7d25684fecb7dab48f5aae411c70704bdd57b162
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d80094973356a6050dc32d3140a1793a1831e3e789b3dc7eff6da3041d885271cd639666d705e04f032846e142e6315f5474d4a6204ab44b527b4602b234e994
|
7
|
+
data.tar.gz: f4b75bc774a3d4dcbec95e9a99f754df15d8f9b4f37437a033effe0a007ad3cb95b41f6fafe8ee3ee9b84b2d274ec4659ec96d2a27a5eca1af18217e2cc1c232
|
data/lib/multi_insert/query.rb
CHANGED
@@ -14,10 +14,10 @@ module MultiInsert
|
|
14
14
|
# Create an ON CONFLICT clause
|
15
15
|
#
|
16
16
|
# @param query [Query] the query.
|
17
|
-
# @param column [String | Symbol] the column to watch for conflicts.
|
17
|
+
# @param column [String | Symbol | nil] the column to watch for conflicts.
|
18
18
|
def initialize(query, column)
|
19
19
|
@query = query
|
20
|
-
@column = column.to_sym
|
20
|
+
@column = column.nil? ? nil : column.to_sym
|
21
21
|
end
|
22
22
|
|
23
23
|
# Ignore conflicting rows.
|
@@ -83,7 +83,7 @@ module MultiInsert
|
|
83
83
|
#
|
84
84
|
# @param column [String | Symbol] The column to watch for conflicts.
|
85
85
|
# @return [Query::OnConflict] A conflict clause.
|
86
|
-
def on_conflict(column)
|
86
|
+
def on_conflict(column = nil)
|
87
87
|
::MultiInsert::Query::OnConflict.new(self, column)
|
88
88
|
end
|
89
89
|
|
@@ -34,8 +34,12 @@ module MultiInsert
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.on_conflict(column)
|
37
|
-
|
38
|
-
|
37
|
+
if column.nil?
|
38
|
+
"ON CONFLICT"
|
39
|
+
else
|
40
|
+
column = ActiveRecord::Base.connection.quote_column_name(column.to_s)
|
41
|
+
"ON CONFLICT (#{column})"
|
42
|
+
end
|
39
43
|
end
|
40
44
|
|
41
45
|
def self.on_conflict_do_nothing(column)
|
data/lib/multi_insert/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_insert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nax
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|