chc-r8 0.3.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6b080d00fb25df7a4f972852c76dd3d323b725e675292acf4f72f85f45c01820
4
+ data.tar.gz: 4c9f1c1b50676e05cdc2a84e0ced034d684120e06bac7772d88933ff9b11a5f5
5
+ SHA512:
6
+ metadata.gz: f9f673ba2e2447d58d1d87d3248ccdf3803b5be538ef45aa35c26549a094c41bb8da0e82f488c9d71fa3866d38f0494b90cae231dbe965718dcca51afc810349
7
+ data.tar.gz: 8bba75feec6c6368c5ad06e6550068fd2dc3531e5b70b1c9ac28ca11b9688a3b3d1c97d146239ee2f7fca0d9f7b2869eafd2f400239d39ed1689b97945e39bda
@@ -0,0 +1,47 @@
1
+ name: Publish
2
+
3
+ permissions:
4
+ actions: read
5
+ contents: read
6
+ checks: read
7
+ packages: write
8
+ statuses: write
9
+
10
+ on:
11
+ push:
12
+ tags:
13
+ - "[0-9]+.[0-9]+.[0-9]+"
14
+
15
+ jobs:
16
+ build-publish:
17
+ name: Build and Publish
18
+ runs-on: ubuntu-latest
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Set Up Ruby
24
+ uses: ruby/setup-ruby@v1.245.0
25
+ with:
26
+ bundler-cache: true
27
+
28
+ - name: Set GitHub Packages Publish API Keys
29
+ run: |
30
+ set +x
31
+ mkdir -p ~/.gem
32
+ cat << EOF > ~/.gem/credentials
33
+ ---
34
+ :github: Bearer ${{ secrets.GITHUB_TOKEN }}
35
+ EOF
36
+
37
+ chmod 0600 ~/.gem/credentials
38
+ set -x
39
+
40
+ - name: Set GEM_NAME
41
+ run: echo "GEM_NAME=$(awk -F'"' '/name *=/ {print $2}' *.gemspec)" >> $GITHUB_ENV
42
+
43
+ - name: Build Gem
44
+ run: bundle exec gem build ./*.gemspec
45
+
46
+ - name: Push Gem
47
+ run: bundle exec gem push ./$GEM_NAME-*.gem --key github --host "https://rubygems.pkg.github.com/chtzvt"
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,73 @@
1
+ stages:
2
+ - test
3
+ - deploy
4
+
5
+ include:
6
+ - component: gitlab.com/gitlab-org/components/gem-release/gem-release@~latest
7
+
8
+ workflow:
9
+ rules:
10
+ # For merge requests, create a pipeline.
11
+ - if: '$CI_MERGE_REQUEST_IID'
12
+ # For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
13
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
14
+ # For tags, create a pipeline.
15
+ - if: '$CI_COMMIT_TAG'
16
+
17
+ default:
18
+ tags:
19
+ - gitlab-org
20
+ cache:
21
+ key:
22
+ files:
23
+ - Gemfile
24
+ - click_house-client.gemspec
25
+ paths:
26
+ - vendor/ruby
27
+
28
+ .default-test-job:
29
+ image: "${GITLAB_DEPENDENCY_PROXY}ruby:${RUBY_VERSION}"
30
+ stage: test
31
+ needs: []
32
+ before_script:
33
+ - gem install bundler
34
+ - bundle install -j $(nproc) --path vendor
35
+ parallel:
36
+ matrix:
37
+ - RUBY_VERSION: ['3.1', '3.2', '3.3']
38
+
39
+ test:rspec:
40
+ extends: .default-test-job
41
+ script:
42
+ - bundle exec rspec
43
+
44
+ test:rubocop:
45
+ extends: .default-test-job
46
+ script:
47
+ - bundle exec rubocop -P -E .
48
+
49
+ include:
50
+ - component: gitlab.com/components/sast/sast@~latest
51
+ - component: gitlab.com/components/secret-detection/secret-detection@~latest
52
+ - component: gitlab.com/gitlab-org/components/gem-release/gem-release@~latest
53
+ inputs:
54
+ gem_name: click_house-client
55
+ file_pattern_to_trigger_release: "lib/**/version.rb"
56
+ - template: Security/Dependency-Scanning.gitlab-ci.yml
57
+
58
+ # run security jobs on MRs
59
+ # see: https://gitlab.com/gitlab-org/gitlab/-/issues/218444#note_478761991
60
+
61
+ gemnasium-dependency_scanning:
62
+ rules:
63
+ - if: '$CI_MERGE_REQUEST_IID'
64
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
65
+
66
+ secret_detection:
67
+ variables:
68
+ # Use a different scanning mode that doesn't rely on commit comparison
69
+ SECURE_ANALYZERS_MODE: "full_repository_scan"
70
+
71
+ rules:
72
+ - if: '$CI_MERGE_REQUEST_IID'
73
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ inherit_gem:
2
+ gitlab-styles:
3
+ - rubocop-default.yml
4
+
5
+ CodeReuse/ActiveRecord:
6
+ Enabled: false
7
+
8
+ AllCops:
9
+ TargetRubyVersion: 3.1
10
+ NewCops: enable
11
+ SuggestExtensions: false
12
+
13
+ RSpec/MultipleMemoizedHelpers:
14
+ Max: 10
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at remy@rymai.me. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,40 @@
1
+ ## Developer Certificate of Origin and License
2
+
3
+ By contributing to GitLab B.V., you accept and agree to the following terms and
4
+ conditions for your present and future contributions submitted to GitLab B.V.
5
+ Except for the license granted herein to GitLab B.V. and recipients of software
6
+ distributed by GitLab B.V., you reserve all right, title, and interest in and to
7
+ your Contributions.
8
+
9
+ All contributions are subject to the Developer Certificate of Origin and license set out at [docs.gitlab.com/ce/legal/developer_certificate_of_origin](https://docs.gitlab.com/ce/legal/developer_certificate_of_origin).
10
+
11
+ _This notice should stay as the first item in the CONTRIBUTING.md file._
12
+
13
+ ## Code of conduct
14
+
15
+ As contributors and maintainers of this project, we pledge to respect all people
16
+ who contribute through reporting issues, posting feature requests, updating
17
+ documentation, submitting pull requests or patches, and other activities.
18
+
19
+ We are committed to making participation in this project a harassment-free
20
+ experience for everyone, regardless of level of experience, gender, gender
21
+ identity and expression, sexual orientation, disability, personal appearance,
22
+ body size, race, ethnicity, age, or religion.
23
+
24
+ Examples of unacceptable behavior by participants include the use of sexual
25
+ language or imagery, derogatory comments or personal attacks, trolling, public
26
+ or private harassment, insults, or other unprofessional conduct.
27
+
28
+ Project maintainers have the right and responsibility to remove, edit, or reject
29
+ comments, commits, code, wiki edits, issues, and other contributions that are
30
+ not aligned to this Code of Conduct. Project maintainers who do not follow the
31
+ Code of Conduct may be removed from the project team.
32
+
33
+ This code of conduct applies both within project spaces and in public spaces
34
+ when an individual is representing the project or its community.
35
+
36
+ Instances of abusive, harassing, or otherwise unacceptable behavior can be
37
+ reported by emailing contact@gitlab.com.
38
+
39
+ This Code of Conduct is adapted from the [Contributor Covenant](https://contributor-covenant.org), version 1.1.0,
40
+ available at [https://contributor-covenant.org/version/1/1/0/](https://contributor-covenant.org/version/1/1/0/).
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,179 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ chc-r8 (0.3.2)
5
+ activerecord (~> 8.0)
6
+ activesupport (~> 8.0)
7
+ addressable (~> 2.8)
8
+ json (~> 2.7)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ activemodel (8.0.2)
14
+ activesupport (= 8.0.2)
15
+ activerecord (8.0.2)
16
+ activemodel (= 8.0.2)
17
+ activesupport (= 8.0.2)
18
+ timeout (>= 0.4.0)
19
+ activesupport (8.0.2)
20
+ base64
21
+ benchmark (>= 0.3)
22
+ bigdecimal
23
+ concurrent-ruby (~> 1.0, >= 1.3.1)
24
+ connection_pool (>= 2.2.5)
25
+ drb
26
+ i18n (>= 1.6, < 2)
27
+ logger (>= 1.4.2)
28
+ minitest (>= 5.1)
29
+ securerandom (>= 0.3)
30
+ tzinfo (~> 2.0, >= 2.0.5)
31
+ uri (>= 0.13.1)
32
+ addressable (2.8.4)
33
+ public_suffix (>= 2.0.2, < 6.0)
34
+ ast (2.4.2)
35
+ base64 (0.3.0)
36
+ benchmark (0.4.1)
37
+ bigdecimal (3.2.2)
38
+ concurrent-ruby (1.3.5)
39
+ connection_pool (2.5.3)
40
+ diff-lcs (1.5.0)
41
+ drb (2.2.3)
42
+ gitlab-styles (12.0.1)
43
+ rubocop (~> 1.62.1)
44
+ rubocop-factory_bot (~> 2.25.1)
45
+ rubocop-graphql (~> 1.5.0)
46
+ rubocop-performance (~> 1.20.2)
47
+ rubocop-rails (~> 2.24.0)
48
+ rubocop-rspec (~> 2.27.1)
49
+ i18n (1.14.1)
50
+ concurrent-ruby (~> 1.0)
51
+ json (2.10.1)
52
+ language_server-protocol (3.17.0.3)
53
+ logger (1.7.0)
54
+ minitest (5.18.1)
55
+ parallel (1.23.0)
56
+ parser (3.3.3.0)
57
+ ast (~> 2.4.1)
58
+ racc
59
+ public_suffix (5.0.3)
60
+ racc (1.7.1)
61
+ rack (3.1.8)
62
+ rainbow (3.1.1)
63
+ rake (13.0.6)
64
+ regexp_parser (2.8.1)
65
+ rexml (3.3.9)
66
+ rspec (3.12.0)
67
+ rspec-core (~> 3.12.0)
68
+ rspec-expectations (~> 3.12.0)
69
+ rspec-mocks (~> 3.12.0)
70
+ rspec-core (3.12.2)
71
+ rspec-support (~> 3.12.0)
72
+ rspec-expectations (3.12.3)
73
+ diff-lcs (>= 1.2.0, < 2.0)
74
+ rspec-support (~> 3.12.0)
75
+ rspec-mocks (3.12.5)
76
+ diff-lcs (>= 1.2.0, < 2.0)
77
+ rspec-support (~> 3.12.0)
78
+ rspec-support (3.12.1)
79
+ rubocop (1.62.1)
80
+ json (~> 2.3)
81
+ language_server-protocol (>= 3.17.0)
82
+ parallel (~> 1.10)
83
+ parser (>= 3.3.0.2)
84
+ rainbow (>= 2.2.2, < 4.0)
85
+ regexp_parser (>= 1.8, < 3.0)
86
+ rexml (>= 3.2.5, < 4.0)
87
+ rubocop-ast (>= 1.31.1, < 2.0)
88
+ ruby-progressbar (~> 1.7)
89
+ unicode-display_width (>= 2.4.0, < 3.0)
90
+ rubocop-ast (1.31.3)
91
+ parser (>= 3.3.1.0)
92
+ rubocop-capybara (2.18.0)
93
+ rubocop (~> 1.41)
94
+ rubocop-factory_bot (2.25.1)
95
+ rubocop (~> 1.41)
96
+ rubocop-graphql (1.5.2)
97
+ rubocop (>= 0.90, < 2)
98
+ rubocop-performance (1.20.2)
99
+ rubocop (>= 1.48.1, < 2.0)
100
+ rubocop-ast (>= 1.30.0, < 2.0)
101
+ rubocop-rails (2.24.1)
102
+ activesupport (>= 4.2.0)
103
+ rack (>= 1.1)
104
+ rubocop (>= 1.33.0, < 2.0)
105
+ rubocop-ast (>= 1.31.1, < 2.0)
106
+ rubocop-rspec (2.27.1)
107
+ rubocop (~> 1.40)
108
+ rubocop-capybara (~> 2.17)
109
+ rubocop-factory_bot (~> 2.22)
110
+ ruby-progressbar (1.13.0)
111
+ securerandom (0.4.1)
112
+ timeout (0.4.3)
113
+ tzinfo (2.0.6)
114
+ concurrent-ruby (~> 1.0)
115
+ unicode-display_width (2.4.2)
116
+ uri (1.0.3)
117
+
118
+ PLATFORMS
119
+ ruby
120
+
121
+ DEPENDENCIES
122
+ chc-r8!
123
+ gitlab-styles (~> 12.0.1)
124
+ rake (~> 13.0)
125
+ rspec (~> 3.0)
126
+ rubocop
127
+ rubocop-rspec
128
+
129
+ CHECKSUMS
130
+ activemodel (8.0.2) sha256=0ae1fb7fa1fae0699ba041a9e97702df42ea3b13f2d39f2d0fde51fca5f0656c
131
+ activerecord (8.0.2) sha256=793470b92c44e4198d0262ac60086b7822f0ea585079ad67e32a6e4c86f2d90a
132
+ activesupport (8.0.2) sha256=8565cddba31b900cdc17682fd66ecd020441e3eef320a9930285394e8c07a45e
133
+ addressable (2.8.4) sha256=40a88af5285625b7fb14070e550e667d5b0cc91f748068701b4d897cacda4897
134
+ ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12
135
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
136
+ benchmark (0.4.1) sha256=d4ef40037bba27f03b28013e219b950b82bace296549ec15a78016552f8d2cce
137
+ bigdecimal (3.2.2) sha256=39085f76b495eb39a79ce07af716f3a6829bc35eb44f2195e2753749f2fa5adc
138
+ chc-r8 (0.3.2)
139
+ concurrent-ruby (1.3.5) sha256=813b3e37aca6df2a21a3b9f1d497f8cbab24a2b94cab325bffe65ee0f6cbebc6
140
+ connection_pool (2.5.3) sha256=cfd74a82b9b094d1ce30c4f1a346da23ee19dc8a062a16a85f58eab1ced4305b
141
+ diff-lcs (1.5.0) sha256=49b934001c8c6aedb37ba19daec5c634da27b318a7a3c654ae979d6ba1929b67
142
+ drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
143
+ gitlab-styles (12.0.1) sha256=d8a302b0ab0e1f18e2d11501760f1b85c5e70b5e5ca628828a0786c7984ed133
144
+ i18n (1.14.1) sha256=9d03698903547c060928e70a9bc8b6b87fda674453cda918fc7ab80235ae4a61
145
+ json (2.10.1) sha256=ddc88ad91a1baf3f0038c174f253af3b086d30dc74db17ca4259bbde982f94dc
146
+ language_server-protocol (3.17.0.3) sha256=3d5c58c02f44a20d972957a9febe386d7e7468ab3900ce6bd2b563dd910c6b3f
147
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
148
+ minitest (5.18.1) sha256=ab5ee381871aaddc3a6aa2a6abcab5c4590fec9affc20947d63f312a0fe4e9cd
149
+ parallel (1.23.0) sha256=27154713ad6ef32fa3dcb7788a721d6c07bca77e72443b4c6080a14145288c49
150
+ parser (3.3.3.0) sha256=a2e23c90918d9b7e866b18dca2b6835f227769dd2fa8e59c5841f3389cf53eeb
151
+ public_suffix (5.0.3) sha256=337d475da2bd2ea1de0446751cb972ad43243b4b00aa8cf91cb904fa593d3259
152
+ racc (1.7.1) sha256=af64124836fdd3c00e830703d7f873ea5deabde923f37006a39f5a5e0da16387
153
+ rack (3.1.8) sha256=d3fbcbca43dc2b43c9c6d7dfbac01667ae58643c42cea10013d0da970218a1b1
154
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
155
+ rake (13.0.6) sha256=5ce4bf5037b4196c24ac62834d8db1ce175470391026bd9e557d669beeb19097
156
+ regexp_parser (2.8.1) sha256=83f63e2bfae3db38f988c66f114485140ff1791321fd827480bc75aa42cacb8c
157
+ rexml (3.3.9) sha256=d71875b85299f341edf47d44df0212e7658cbdf35aeb69cefdb63f57af3137c9
158
+ rspec (3.12.0) sha256=ccc41799a43509dc0be84070e3f0410ac95cbd480ae7b6c245543eb64162399c
159
+ rspec-core (3.12.2) sha256=155b54480f28e2b2813185077fe435c2d663031616360ed3b179a9d6a55d2551
160
+ rspec-expectations (3.12.3) sha256=093d18e2e7e0a2c619ef8f7343d442fc6c0793fb7897d56f16f26c8a9d244416
161
+ rspec-mocks (3.12.5) sha256=82030d2bfa1e4eef0a2ee36af5d3d224672598912a3f3384f27cbba9fa09d5c1
162
+ rspec-support (3.12.1) sha256=f969b85d0068ff97bc47c9d6fc2bca9706d73406f2b4e5d3b346443d8734c8cf
163
+ rubocop (1.62.1) sha256=aeb1ec501aef5833617b3b6a1512303806218c349c28ce5b3ea72e3782ad4a35
164
+ rubocop-ast (1.31.3) sha256=1b07d618d8776993ec6053a706d1c09f0bf15139fd69415924656cbff07e7818
165
+ rubocop-capybara (2.18.0) sha256=66b256755101f76dc455ba9694e2414bc957db5200401d204b00bc835401d605
166
+ rubocop-factory_bot (2.25.1) sha256=62751bde7af789878b8a31cbd2a82e69515ce7b23a2ad1820cb0fcc3e0150134
167
+ rubocop-graphql (1.5.2) sha256=9e5fb5909607d0d68bb6e924d8f916476c9706e81d8676c53960c7c5f3eadb85
168
+ rubocop-performance (1.20.2) sha256=1bb1fa8c427fac7ba3c8dd2decb9860f23cb2d6c40350bedc88538de8875c731
169
+ rubocop-rails (2.24.1) sha256=03edf766954947468f3686cedb69142fae4f10e2007287f89cc0ea7072eeac19
170
+ rubocop-rspec (2.27.1) sha256=2f27ce04700be75db65afe83d7993a36e0fafd07ec062222f4b3cc10137a7a9e
171
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
172
+ securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
173
+ timeout (0.4.3) sha256=9509f079b2b55fe4236d79633bd75e34c1c1e7e3fb4b56cb5fda61f80a0fe30e
174
+ tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
175
+ unicode-display_width (2.4.2) sha256=6a10205d1a19ca790c4e53064ba93f09d9eb234bf6bd135d9deb6001c21428be
176
+ uri (1.0.3) sha256=e9f2244608eea2f7bc357d954c65c910ce0399ca5e18a7a29207ac22d8767011
177
+
178
+ BUNDLED WITH
179
+ 2.6.5
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present GitLab Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # ClickHouse::Client
2
+
3
+ This Gem provides a simple way to query ClickHouse databases using the HTTP interface.
4
+
5
+ ## Example usage
6
+
7
+ ```ruby
8
+ require 'logger'
9
+ require 'net/http'
10
+
11
+ ClickHouse::Client.configure do |config|
12
+ # Register your database(s)
13
+ config.register_database(:main,
14
+ database: 'default',
15
+ url: 'http://localhost:8123',
16
+ username: 'default',
17
+ password: 'clickhouse',
18
+ variables: { mutations_sync: 1 }
19
+ )
20
+
21
+ config.logger = Logger.new(STDOUT)
22
+
23
+ # Use any HTTP client to build the POST request, here we use Net::HTTP
24
+ config.http_post_proc = ->(url, headers, body) do
25
+ # Query placeholders go to the URI
26
+ params = URI.encode_www_form(body.except("query"))
27
+
28
+ uri = URI.parse("#{url}&#{params}")
29
+ request = Net::HTTP::Post.new(uri)
30
+
31
+ headers.each do |header, value|
32
+ request[header] = value
33
+ end
34
+
35
+ request['Content-type'] = 'application/x-www-form-urlencoded'
36
+ request.body = body["query"]
37
+
38
+ response = Net::HTTP.start(uri.hostname, uri.port) do |http|
39
+ http.request(request)
40
+ end
41
+
42
+ ClickHouse::Client::Response.new(response.body, response.code.to_i, response.each_header.to_h)
43
+ end
44
+ end
45
+
46
+ # Run some statements
47
+ puts ClickHouse::Client.select('SELECT 1+1', :main)
48
+
49
+ query = ClickHouse::Client::Query.new(raw_query: 'SELECT {number1:Int64} + {number2:Int64}', placeholders: { number1: 11, number2: 4 })
50
+ puts ClickHouse::Client.select(query, :main)
51
+
52
+ puts ClickHouse::Client.execute('CREATE TABLE IF NOT EXISTS t1 (id Int64) ENGINE=MergeTree PRIMARY KEY id', :main)
53
+ puts ClickHouse::Client.execute('DROP TABLE IF EXISTS t1', :main)
54
+ ```
55
+
56
+ ## License
57
+
58
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
59
+
60
+ ## Code of Conduct
61
+
62
+ Everyone interacting in the Gitlab::Danger project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/gitlab-org/ruby/gems/clickhouse-client/-/blob/main/CODE_OF_CONDUCT.md?ref_type=heads).
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/click_house/client/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "chc-r8"
7
+ spec.version = ClickHouse::Client::VERSION
8
+ spec.authors = ["group::optimize"]
9
+ spec.email = ["engineering@gitlab.com"]
10
+
11
+ spec.summary = "GitLab's client to interact with ClickHouse"
12
+ spec.description = "This Gem provides a simple way to query ClickHouse databases using the HTTP interface."
13
+ spec.homepage = "https://gitlab.com/gitlab-org/ruby/gems/clickhouse-client"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.1"
16
+
17
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_runtime_dependency "activerecord", "~> 8.0"
24
+ spec.add_runtime_dependency "activesupport", "~> 8.0"
25
+ spec.add_runtime_dependency "addressable", "~> 2.8"
26
+ spec.add_runtime_dependency 'json', '~> 2.7'
27
+
28
+ spec.add_development_dependency 'gitlab-styles', '~> 12.0.1'
29
+ spec.add_development_dependency "rake", "~> 13.0"
30
+ spec.add_development_dependency "rspec", "~> 3.0"
31
+ spec.add_development_dependency 'rubocop'
32
+ spec.add_development_dependency 'rubocop-rspec'
33
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ClickHouse
4
+ module Client
5
+ class ArelEngine
6
+ def quote_table_name(name)
7
+ "`#{name}`" # Safest approach for ClickHouse
8
+ end
9
+
10
+ def quote_column_name(name)
11
+ quote_table_name(name)
12
+ end
13
+
14
+ def quote(value)
15
+ ClickHouse::Client::Quoting.quote(value)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ClickHouse
4
+ module Client
5
+ class BindIndexManager
6
+ def initialize(start_index = 1)
7
+ @current_index = start_index
8
+ end
9
+
10
+ def next_bind_str
11
+ bind_str = "$#{@current_index}"
12
+ @current_index += 1
13
+ bind_str
14
+ end
15
+ end
16
+ end
17
+ end