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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dfcf5de90cdcac42af2c68794fd94b2d97976edabebc30c7af030b03a4cc26f
4
- data.tar.gz: 62d372644b0997607dc8cb73e4c95e0c29b4942b7519bea26cdfc3e960007899
3
+ metadata.gz: 4c89216cc9c88e455670f35269bc949eb5e0bc1ac6ce04e02a3b03eb5d00b654
4
+ data.tar.gz: 3a943f93bb7c7fbfdf3d469afa0d5577e795dde5761d1b63229c8aa94fb60cfe
5
5
  SHA512:
6
- metadata.gz: 2eb9f39a73f585d769ac0e65f123f995a19d0129659e18b2d3978eb85668a32754ef859b3bef162d063c2cd720b4684e85247979ab3422485a179314566a2128
7
- data.tar.gz: d70133876b5a852d6e3e6d73d9a4d76818e078ef5b46b0dc530a36801a48caa73764f9cc275794c75d6409a96dc4a5a67ad201d72f0741111dbc0f895b93463c
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.33)
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.6)
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.3)
35
+ i18n (1.14.5)
36
36
  concurrent-ruby (~> 1.0)
37
- racc (~> 1.7)
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)
@@ -1,5 +1,5 @@
1
1
 
2
2
  module DynamicRecordsMeritfront
3
- VERSION = '3.1.33'
3
+ VERSION = '3.1.34'
4
4
  end
5
5
  #this file gets overwritten automatically on minor updates, major ones need to be manually changed
@@ -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
- "#{ws[:table_name]} AS (\n#{ws[:sql]}\n)"
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, base_name: base_name, base_on: base_on, attach_on: attach_on, one_to_one: one_to_one, as: as}
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.33
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-03-06 00:00:00.000000000 Z
11
+ date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashid-rails