soql_builder 1.0.5 → 1.0.6

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: ffcd93c75d97fff1473a54e9e22fb187a8e4196046db8caf74d746ac7187448b
4
- data.tar.gz: 1202cc894c24d22f72b697a779377302c8853d3ff30102a2c5d050624773bf2d
3
+ metadata.gz: e01133aafa8d9360cb78ada93dd1a4d3fcaa9fa671831343202ac0414634f4b6
4
+ data.tar.gz: ead65eddcefbb4853110254ce559f78c6c620e31c5c7b7c8002166a6b441427d
5
5
  SHA512:
6
- metadata.gz: f6daed2b7355eef9c0b12ec116a70676f54b1961640aa7ebce9ea6ab66bc80d8a333d794d906213f94af967d396701449ac06ffaf6a9d388b79ad7d95e98f248
7
- data.tar.gz: 9a6ee1363f638789810a05de38b95a50cdc84beb6db489252002934074272b064c8a992d9ab8da9a64a768c77b42878ad27d17e45c968de5960fc2c1f6ea7a56
6
+ metadata.gz: 97f41e9547619b75cb7534dd0ce4e4486c5bd36e5034e7f689948b295553a0022ba7a00dd47d533a5ee2b60979438d35e31c79242fd9593981de6db9e46b18e1
7
+ data.tar.gz: 4085a471ed4ed7eddce845f4a34f47174ed934d08800306cac99f0ee71ba5a86abdeb2f07c5f72d369ff1ac1c3aeee3cf86a98cd2451ad4a1d3ce94c7fa26c27
data/README.md CHANGED
@@ -77,4 +77,30 @@ builder.query
77
77
  => "select Name, Contract__r.Name, (select Quotes.Name, Quotes.id from Account.Quotes) from Account where id = 1"
78
78
  ```
79
79
 
80
+ **Reset the query and create another one with the same object**
81
+
82
+ ```ruby
83
+ builder.fields(['Name', 'Contract__r.Name'])
84
+
85
+ builder.add_subquery(
86
+ table: 'Account.Quotes',
87
+ fields: ['Quotes.Name', 'Quotes.id']
88
+ )
89
+
90
+ builder.from('Account')
91
+
92
+ builder.where('id = 1')
93
+
94
+ builder.query
95
+ => "select Name, Contract__r.Name, (select Quotes.Name, Quotes.id from Account.Quotes) from Account where id = 1"
96
+
97
+ builder.clean
98
+
99
+ builder.fields(['Name', 'Contract__r.Name'])
100
+ .from('Account')
101
+ .where('id = 1')
102
+
103
+ builder.query
104
+ => "select Name, Contract__r.Name from Account where id = 1"
105
+ ```
80
106
 
@@ -32,6 +32,14 @@ module Soql
32
32
  qs
33
33
  end
34
34
 
35
+ def clean
36
+ @fields = []
37
+ @subquery = { object_table: '', fields: [] }
38
+ @object_table = ''
39
+ @where = ''
40
+ @limit = ''
41
+ end
42
+
35
43
  private
36
44
 
37
45
  def join_fields(fields)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Soql
4
- VERSION = '1.0.5'.freeze
4
+ VERSION = '1.0.6'.freeze
5
5
  end
@@ -12,6 +12,10 @@ class SoqlBuilder
12
12
  @query.structure_query
13
13
  end
14
14
 
15
+ def clean
16
+ @query.clean
17
+ end
18
+
15
19
  def fields(fields = [])
16
20
  @query.fields = fields
17
21
  self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soql_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Avlonitis