click_house-client 0.8.3 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f12c7192094a0cec94c354381b9be928dff901c03a9e8522dde43a695ce99b62
4
- data.tar.gz: bedf93d6760663e747598c2cf9f60b90106b5d6979a7fe11dd00749cb03e4326
3
+ metadata.gz: 0e2ca8f0530ff3f9a48853609325b69481909e1bf4b6d208cee425430cc3b3e0
4
+ data.tar.gz: 98c2180b46b3345de18d3525c070fc59f7acd88897a6f8e593a8b7b97e69d2d0
5
5
  SHA512:
6
- metadata.gz: 5fe06dbc303e5b94e72e84b0da50c96defa1be6445a77236ad29f49ed4283cb0e0d5ce147e5bafba671ac01d7064be5c3f0e4f80ff83ffe74eae7207f1b6a56e
7
- data.tar.gz: a183e8f5081a5f1c4463e0b35c5fde96968023555c6b65ef4e5495a52650f747a224dfb468145cb3c5d5a55333e859398db6284952fec9c323f0bec3a4b6247e
6
+ metadata.gz: 23f2d4022f33b6795030e73a68f0549d06d1925221f08d49f0a314e87096de83fdd641d12597960f71e08656d81bf2af5b46483f8e113464d6e8bcd83fe2a7a4
7
+ data.tar.gz: 5492a6fb7bbb700722fbf4684570ba4d4d220be2c5316a98461e9e6b857cb549b5bfa7fb1173dc38beae27b9df9f945eca1ed1568a061774f3fd6b3b6b2aca63
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .rspec_status
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- click_house-client (0.8.3)
4
+ click_house-client (0.8.4)
5
5
  activerecord (>= 7.0, < 9.0)
6
6
  activesupport (>= 7.0, < 9.0)
7
7
  addressable (~> 2.8)
@@ -136,7 +136,7 @@ CHECKSUMS
136
136
  benchmark (0.4.1) sha256=d4ef40037bba27f03b28013e219b950b82bace296549ec15a78016552f8d2cce
137
137
  bigdecimal (3.2.2) sha256=39085f76b495eb39a79ce07af716f3a6829bc35eb44f2195e2753749f2fa5adc
138
138
  byebug (12.0.0) sha256=d4a150d291cca40b66ec9ca31f754e93fed8aa266a17335f71bb0afa7fca1a1e
139
- click_house-client (0.8.3)
139
+ click_house-client (0.8.4)
140
140
  concurrent-ruby (1.3.5) sha256=813b3e37aca6df2a21a3b9f1d497f8cbab24a2b94cab325bffe65ee0f6cbebc6
141
141
  connection_pool (2.5.3) sha256=cfd74a82b9b094d1ce30c4f1a346da23ee19dc8a062a16a85f58eab1ced4305b
142
142
  diff-lcs (1.5.0) sha256=49b934001c8c6aedb37ba19daec5c634da27b318a7a3c654ae979d6ba1929b67
@@ -29,6 +29,8 @@ module ClickHouse
29
29
  Arel::Nodes::As
30
30
  ].freeze
31
31
 
32
+ delegate :[], to: :table
33
+
32
34
  def initialize(table, alias_name = nil)
33
35
  @table = if table.is_a?(self.class) # subquery
34
36
  Arel::Nodes::TableAlias.new(table.to_arel, alias_name)
@@ -68,6 +70,15 @@ module ClickHouse
68
70
  end
69
71
  end
70
72
 
73
+ # Evaluates given block in scope of current builder. Example:
74
+ # query = ClickHouse::Client::QueryBuilder.new('test_table').build do
75
+ # select(named_func('argMax', [table[:id], table[:timestamp]]).as('max_id')).limit(10)
76
+ # end
77
+ # @return [ClickHouse::QueryBuilder] New instance of query builder.
78
+ def build(&)
79
+ instance_eval(&)
80
+ end
81
+
71
82
  # The `having` method applies constraints to the HAVING clause, similar to how
72
83
  # `where` applies constraints to the WHERE clause. It supports the same constraint types.
73
84
  # Correct usage:
@@ -186,6 +197,20 @@ module ClickHouse
186
197
  end
187
198
  end
188
199
 
200
+ # Shortcut for `Arel::Nodes::NamedFunction.new`
201
+ # @return [Arel::Nodes::NamedFunction]
202
+ def named_func(*args)
203
+ Arel::Nodes::NamedFunction.new(*args)
204
+ end
205
+
206
+ # Shortcut for `Arel::Nodes.build_quoted`
207
+ # @return [Arel::Nodes::Node]
208
+ def quote(...)
209
+ Arel::Nodes.build_quoted(...)
210
+ end
211
+
212
+ alias_method :func, :named_func
213
+
189
214
  # Aggregation helper methods
190
215
 
191
216
  # Creates an AVG aggregate function node
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ClickHouse
4
4
  module Client
5
- VERSION = "0.8.3"
5
+ VERSION = "0.8.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: click_house-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - group::optimize
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-21 00:00:00.000000000 Z
11
+ date: 2025-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -170,6 +170,7 @@ executables: []
170
170
  extensions: []
171
171
  extra_rdoc_files: []
172
172
  files:
173
+ - ".gitignore"
173
174
  - ".gitlab-ci.yml"
174
175
  - ".rspec"
175
176
  - ".rubocop.yml"