multi_insert 0.1.6 → 0.1.7
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 +1 -1
- data/lib/multi_insert/query_builder.rb +5 -1
- data/lib/multi_insert/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14fe30a32e5c6287987c5ef9c096ac641711c65a
|
4
|
+
data.tar.gz: 5c08654357b2f14e7599a9a63f9246d821c31223
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5b0e2453ac9474b8d7f37d69af7911bbe800e3c46f55949ce66e45f465b91bb3228ba1b392be125343b1650accb033d9cec751dc7d29529d3d6190b61e3bc8f
|
7
|
+
data.tar.gz: 66f3ccccc3d543da757f4f627b1b165dde379f9ccf70c15ebac9ab1ea078cd008e226795da6fdd306e5a5b6f0cd75692c2e0d35dc7fb1f7ba5d196939174e2ff
|
data/lib/multi_insert/query.rb
CHANGED
@@ -5,7 +5,7 @@ module MultiInsert
|
|
5
5
|
class Query
|
6
6
|
def initialize(table, columns, values, opts = {})
|
7
7
|
@table = table.to_sym
|
8
|
-
@sql_insert = ::MultiInsert::QueryBuilder.insert(table, columns, values, opts
|
8
|
+
@sql_insert = ::MultiInsert::QueryBuilder.insert(table, columns, values, opts)
|
9
9
|
end
|
10
10
|
|
11
11
|
def returning(columns)
|
@@ -2,10 +2,14 @@ require 'active_record'
|
|
2
2
|
|
3
3
|
module MultiInsert
|
4
4
|
module QueryBuilder
|
5
|
+
INSERT_DEFAULTS = {
|
6
|
+
time: true
|
7
|
+
}
|
8
|
+
|
5
9
|
def self.insert(table, columns, values, opts = {})
|
6
10
|
ar = ActiveRecord::Base.connection
|
7
11
|
|
8
|
-
opts.merge
|
12
|
+
opts = INSERT_DEFAULTS.merge(opts)
|
9
13
|
|
10
14
|
now = Time.now.to_s(:db) if opts[:time]
|
11
15
|
table = ar.quote_table_name(table.to_s)
|
data/lib/multi_insert/version.rb
CHANGED