dynamic-records-meritfront 3.1.33 → 3.1.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -6
- data/lib/dynamic-records-meritfront/version.rb +1 -1
- data/lib/dynamic-records-meritfront.rb +10 -5
- 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: 4c89216cc9c88e455670f35269bc949eb5e0bc1ac6ce04e02a3b03eb5d00b654
|
4
|
+
data.tar.gz: 3a943f93bb7c7fbfdf3d469afa0d5577e795dde5761d1b63229c8aa94fb60cfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 698dc9dc2d4cf602cd54e2b7633062177e7773095b3e94b06188c4d06a82bdea83df074af16f0b95c060f461c8ef82f7a7c272d3fa8d738660e62472118a9733
|
7
|
+
data.tar.gz: b49b8029d106e0dd729520fc2985be6e562a1a1b8f80028e3c13d1efb15a68ff539abe7be0826a3871e9eed34a068ea516ede0e5634960889ff9437c6c876f87
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dynamic-records-meritfront (3.1.
|
4
|
+
dynamic-records-meritfront (3.1.34)
|
5
5
|
hashid-rails
|
6
6
|
|
7
7
|
GEM
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
mutex_m
|
25
25
|
tzinfo (~> 2.0)
|
26
26
|
base64 (0.2.0)
|
27
|
-
bigdecimal (3.1.
|
27
|
+
bigdecimal (3.1.8)
|
28
28
|
concurrent-ruby (1.2.3)
|
29
29
|
connection_pool (2.4.1)
|
30
30
|
drb (2.2.1)
|
@@ -32,12 +32,10 @@ GEM
|
|
32
32
|
activerecord (>= 4.0)
|
33
33
|
hashids (~> 1.0)
|
34
34
|
hashids (1.0.6)
|
35
|
-
i18n (1.14.
|
35
|
+
i18n (1.14.5)
|
36
36
|
concurrent-ruby (~> 1.0)
|
37
|
-
|
38
|
-
minitest (5.22.2)
|
37
|
+
minitest (5.22.3)
|
39
38
|
mutex_m (0.2.0)
|
40
|
-
racc (1.7.3)
|
41
39
|
rake (12.3.3)
|
42
40
|
timeout (0.4.1)
|
43
41
|
tzinfo (2.0.6)
|
@@ -595,7 +595,11 @@ module DynamicRecordsMeritfront
|
|
595
595
|
def _dynamic_instaload_handle_with_statements(with_statements)
|
596
596
|
%Q{WITH #{
|
597
597
|
with_statements.map{|ws|
|
598
|
-
|
598
|
+
if(ws[:with])
|
599
|
+
"#{ws[:with]} AS (\n#{ws[:sql]}\n)"
|
600
|
+
else
|
601
|
+
"#{ws[:table_name]} AS (\n#{ws[:sql]}\n)"
|
602
|
+
end
|
599
603
|
}.join(", \n")
|
600
604
|
}}
|
601
605
|
end
|
@@ -615,13 +619,13 @@ module DynamicRecordsMeritfront
|
|
615
619
|
#{ other_statements.map{|os| "SELECT row_to_json(#{os[:table_name]}.*) AS row, '#{os[:klass]}' AS _klass FROM (\n#{os[:sql]}\n)) AS #{os[:table_name]}\n" }.join(' UNION ALL ')}
|
616
620
|
end
|
617
621
|
|
618
|
-
def instaload(sql, table_name: nil, relied_on: false, dont_return: false, base_name: nil, base_on: nil, attach_on: nil, one_to_one: false, as: nil)
|
622
|
+
def instaload(sql, table_name: nil, relied_on: false, dont_return: false, base_name: nil, base_on: nil, attach_on: nil, one_to_one: false, as: nil, with: nil)
|
619
623
|
#this function just makes everything a little easier to deal with by providing defaults, making it nicer to call, and converting potential symbols to strings.
|
620
624
|
#At the end of the day it just returns a hash with the settings in it though. So dont overthink it too much.
|
621
625
|
|
622
626
|
as = as.to_s if as
|
623
627
|
base_name = base_name.to_s if base_name
|
624
|
-
|
628
|
+
|
625
629
|
if table_name
|
626
630
|
table_name = table_name.to_s
|
627
631
|
else
|
@@ -633,7 +637,8 @@ module DynamicRecordsMeritfront
|
|
633
637
|
sql = "\t" + sql.strip
|
634
638
|
raise StandardError.new("base_on needs to be nil or a Proc") unless base_on.nil? or base_on.kind_of? Proc
|
635
639
|
raise StandardError.new("attach_on needs to be nil or a Proc") unless attach_on.nil? or attach_on.kind_of? Proc
|
636
|
-
return {table_name: table_name, klass: klass, sql: sql, relied_on: relied_on, dont_return: dont_return,
|
640
|
+
return { table_name: table_name, klass: klass, sql: sql, relied_on: relied_on, dont_return: dont_return,
|
641
|
+
base_name: base_name, base_on: base_on, attach_on: attach_on, one_to_one: one_to_one, as: as, with: with }
|
637
642
|
end
|
638
643
|
|
639
644
|
def instaload_sql(*args) #name, insta_array, opts = { })
|
@@ -647,7 +652,7 @@ module DynamicRecordsMeritfront
|
|
647
652
|
raise StandardError.new("bad input to DynamicRecordsMeritfront#instaload_sql method.")
|
648
653
|
end
|
649
654
|
|
650
|
-
with_statements = insta_array.select{|a| a[:relied_on]}
|
655
|
+
with_statements = insta_array.select{|a| a[:relied_on] or a[:with]}
|
651
656
|
sql = %Q{
|
652
657
|
#{ _dynamic_instaload_handle_with_statements(with_statements) if with_statements.any? }
|
653
658
|
#{ _dynamic_instaload_union(insta_array)}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic-records-meritfront
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Clancy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashid-rails
|