mini_sql 0.2.2 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +66 -0
- data/.rubocop-https---raw-githubusercontent-com-discourse-discourse-master--rubocop-yml +355 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG +22 -0
- data/Gemfile +3 -1
- data/Guardfile +2 -0
- data/README.md +90 -2
- data/Rakefile +3 -1
- data/bench/timestamp_perf.rb +22 -21
- data/bench/topic_mysql_perf.rb +304 -0
- data/bench/topic_perf.rb +175 -11
- data/bin/console +1 -0
- data/lib/mini_sql.rb +8 -0
- data/lib/mini_sql/builder.rb +10 -2
- data/lib/mini_sql/connection.rb +17 -3
- data/lib/mini_sql/decoratable.rb +22 -0
- data/lib/mini_sql/deserializer_cache.rb +2 -0
- data/lib/mini_sql/inline_param_encoder.rb +9 -9
- data/lib/mini_sql/mysql/connection.rb +67 -0
- data/lib/mini_sql/mysql/deserializer_cache.rb +57 -0
- data/lib/mini_sql/postgres/coders.rb +2 -0
- data/lib/mini_sql/postgres/connection.rb +80 -3
- data/lib/mini_sql/postgres/deserializer_cache.rb +33 -13
- data/lib/mini_sql/postgres_jdbc/connection.rb +6 -1
- data/lib/mini_sql/postgres_jdbc/deserializer_cache.rb +43 -43
- data/lib/mini_sql/result.rb +20 -0
- data/lib/mini_sql/serializer.rb +70 -0
- data/lib/mini_sql/sqlite/connection.rb +12 -4
- data/lib/mini_sql/sqlite/deserializer_cache.rb +11 -13
- data/lib/mini_sql/version.rb +2 -1
- data/mini_sql.gemspec +15 -3
- metadata +80 -13
- data/.travis.yml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d668e0b456e27a572040825399ca9477d6c4404bfc09e6e87b1330a106491a0
|
4
|
+
data.tar.gz: 3fb2027b34d3837e06f6c92b7075f8811296c0750c5c4c3ae48d6053189a4000
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60449b0a92a13aa471dbc1dd6db2b8ba0571bca67f81bd46644bf8678ab794b5447e59cd3ea7a24d4732bcdb8eca44c9dfec748c57418d826444305395f62190
|
7
|
+
data.tar.gz: a249f769da221d659d1b4dceaf3dd153578fbda3f0951bdac938d178923a54ad852106629d76be38b5c4ad83c4175592b9971223f8e0aab49e91a48747ad7148
|
@@ -0,0 +1,66 @@
|
|
1
|
+
name: Mini SQL Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- master
|
8
|
+
|
9
|
+
env:
|
10
|
+
PGHOST: localhost
|
11
|
+
PGPORT: 5432
|
12
|
+
PGPASSWORD: postgres
|
13
|
+
PGUSER: postgres
|
14
|
+
MINI_SQL_MYSQL_HOST: 127.0.0.1
|
15
|
+
MINI_SQL_MYSQL_PORT: 3306
|
16
|
+
MINI_SQL_MYSQL_PASSWORD: mysql
|
17
|
+
jobs:
|
18
|
+
build:
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
name: Ruby ${{ matrix.ruby }}
|
21
|
+
services:
|
22
|
+
postgres:
|
23
|
+
image: postgres:9.6
|
24
|
+
env:
|
25
|
+
POSTGRES_PASSWORD: postgres
|
26
|
+
ports:
|
27
|
+
- 5432:5432
|
28
|
+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
29
|
+
mysql:
|
30
|
+
image: mysql:5.7
|
31
|
+
env:
|
32
|
+
MYSQL_ROOT_PASSWORD: mysql
|
33
|
+
ports:
|
34
|
+
- 3306:3306
|
35
|
+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
36
|
+
strategy:
|
37
|
+
matrix:
|
38
|
+
ruby: ["2.7", "2.6", "2.5"]
|
39
|
+
experimental: [false]
|
40
|
+
include:
|
41
|
+
- ruby: ruby-head
|
42
|
+
experimental: true
|
43
|
+
steps:
|
44
|
+
- uses: actions/checkout@v2
|
45
|
+
- uses: ruby/setup-ruby@v1
|
46
|
+
with:
|
47
|
+
ruby-version: ${{ matrix.ruby }}
|
48
|
+
- name: Bundler cache
|
49
|
+
uses: actions/cache@v2
|
50
|
+
with:
|
51
|
+
path: vendor/bundle
|
52
|
+
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
53
|
+
restore-keys: |
|
54
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-
|
55
|
+
- name: Create Databases
|
56
|
+
run: |
|
57
|
+
createdb test_mini_sql
|
58
|
+
mysql --host=127.0.0.1 --port=3306 --user=root --password=mysql -e 'CREATE DATABASE test_mini_sql'
|
59
|
+
- name: Setup gems
|
60
|
+
run: |
|
61
|
+
bundle config path vendor/bundle
|
62
|
+
bundle install --jobs 4
|
63
|
+
- name: Tests
|
64
|
+
run: bundle exec rake test
|
65
|
+
- name: Rubocop
|
66
|
+
run: bundle exec rubocop
|
@@ -0,0 +1,355 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-discourse
|
3
|
+
- rubocop-rspec
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.6
|
7
|
+
DisabledByDefault: true
|
8
|
+
Exclude:
|
9
|
+
- "db/schema.rb"
|
10
|
+
- "bundle/**/*"
|
11
|
+
- "vendor/**/*"
|
12
|
+
- "node_modules/**/*"
|
13
|
+
- "public/**/*"
|
14
|
+
- "plugins/**/gems/**/*"
|
15
|
+
|
16
|
+
Discourse:
|
17
|
+
Enabled: true
|
18
|
+
|
19
|
+
Discourse/NoChdir:
|
20
|
+
Exclude:
|
21
|
+
- 'spec/**/*' # Specs are run sequentially, so chdir can be used
|
22
|
+
- 'plugins/*/spec/**/*'
|
23
|
+
|
24
|
+
# Prefer &&/|| over and/or.
|
25
|
+
Style/AndOr:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
Style/FrozenStringLiteralComment:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
# Align `when` with `case`.
|
32
|
+
Layout/CaseIndentation:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
# Align comments with method definitions.
|
36
|
+
Layout/CommentIndentation:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
# No extra empty lines.
|
40
|
+
Layout/EmptyLines:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
44
|
+
Style/HashSyntax:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
# Two spaces, no tabs (for indentation).
|
48
|
+
Layout/IndentationWidth:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Layout/SpaceAfterColon:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
Layout/SpaceAfterComma:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Layout/SpaceAroundKeyword:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Layout/SpaceAroundOperators:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Layout/SpaceBeforeFirstArg:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
# Defining a method with parameters needs parentheses.
|
70
|
+
Style/MethodDefParentheses:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
# Use `foo {}` not `foo{}`.
|
74
|
+
Layout/SpaceBeforeBlockBraces:
|
75
|
+
Enabled: true
|
76
|
+
|
77
|
+
# Use `foo { bar }` not `foo {bar}`.
|
78
|
+
Layout/SpaceInsideBlockBraces:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
82
|
+
Layout/SpaceInsideHashLiteralBraces:
|
83
|
+
Enabled: true
|
84
|
+
|
85
|
+
Layout/SpaceInsideParens:
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
# Detect hard tabs, no hard tabs.
|
89
|
+
Layout/Tab:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
# Blank lines should not have any spaces.
|
93
|
+
Layout/TrailingEmptyLines:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
# No trailing whitespace.
|
97
|
+
Layout/TrailingWhitespace:
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
Lint/Debugger:
|
101
|
+
Enabled: true
|
102
|
+
|
103
|
+
Layout/BlockAlignment:
|
104
|
+
Enabled: true
|
105
|
+
|
106
|
+
# Align `end` with the matching keyword or starting expression except for
|
107
|
+
# assignments, where it should be aligned with the LHS.
|
108
|
+
Layout/EndAlignment:
|
109
|
+
Enabled: true
|
110
|
+
EnforcedStyleAlignWith: variable
|
111
|
+
|
112
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
113
|
+
Lint/RequireParentheses:
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
Lint/ShadowingOuterLocalVariable:
|
117
|
+
Enabled: true
|
118
|
+
|
119
|
+
Layout/MultilineMethodCallIndentation:
|
120
|
+
Enabled: true
|
121
|
+
EnforcedStyle: indented
|
122
|
+
|
123
|
+
Layout/HashAlignment:
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
Bundler/OrderedGems:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
Style/SingleLineMethods:
|
130
|
+
Enabled: true
|
131
|
+
|
132
|
+
Style/Semicolon:
|
133
|
+
Enabled: true
|
134
|
+
AllowAsExpressionSeparator: true
|
135
|
+
|
136
|
+
Style/RedundantReturn:
|
137
|
+
Enabled: true
|
138
|
+
|
139
|
+
Style/GlobalVars:
|
140
|
+
Enabled: true
|
141
|
+
Severity: warning
|
142
|
+
Exclude:
|
143
|
+
- 'lib/tasks/**/*'
|
144
|
+
- 'script/**/*'
|
145
|
+
- 'spec/**/*.rb'
|
146
|
+
- 'plugins/*/spec/**/*'
|
147
|
+
|
148
|
+
# Specs
|
149
|
+
|
150
|
+
RSpec/AnyInstance:
|
151
|
+
Enabled: false # To be decided
|
152
|
+
|
153
|
+
RSpec/AroundBlock:
|
154
|
+
Enabled: true
|
155
|
+
|
156
|
+
RSpec/BeforeAfterAll:
|
157
|
+
Enabled: false # To be decided
|
158
|
+
|
159
|
+
RSpec/ContextMethod:
|
160
|
+
Enabled: false # TODO
|
161
|
+
|
162
|
+
RSpec/ContextWording:
|
163
|
+
Enabled: false # To be decided
|
164
|
+
|
165
|
+
RSpec/DescribeClass:
|
166
|
+
Enabled: false # To be decided
|
167
|
+
|
168
|
+
RSpec/DescribeMethod:
|
169
|
+
Enabled: true
|
170
|
+
|
171
|
+
RSpec/DescribeSymbol:
|
172
|
+
Enabled: false # To be decided
|
173
|
+
|
174
|
+
RSpec/DescribedClass:
|
175
|
+
Enabled: false # To be decided
|
176
|
+
|
177
|
+
RSpec/DescribedClassModuleWrapping:
|
178
|
+
Enabled: false # To be decided
|
179
|
+
|
180
|
+
RSpec/EmptyExampleGroup:
|
181
|
+
Enabled: true
|
182
|
+
|
183
|
+
RSpec/EmptyLineAfterExample:
|
184
|
+
Enabled: false # TODO
|
185
|
+
|
186
|
+
RSpec/EmptyLineAfterExampleGroup:
|
187
|
+
Enabled: false # TODO
|
188
|
+
|
189
|
+
RSpec/EmptyLineAfterFinalLet:
|
190
|
+
Enabled: false # TODO
|
191
|
+
|
192
|
+
RSpec/EmptyLineAfterHook:
|
193
|
+
Enabled: false # TODO
|
194
|
+
|
195
|
+
RSpec/EmptyLineAfterSubject:
|
196
|
+
Enabled: false # TODO
|
197
|
+
|
198
|
+
RSpec/ExampleLength:
|
199
|
+
Enabled: false # To be decided
|
200
|
+
|
201
|
+
RSpec/ExampleWithoutDescription:
|
202
|
+
Enabled: true
|
203
|
+
|
204
|
+
RSpec/ExampleWording:
|
205
|
+
Enabled: false # TODO
|
206
|
+
|
207
|
+
RSpec/ExpectActual:
|
208
|
+
Enabled: true
|
209
|
+
|
210
|
+
RSpec/ExpectChange:
|
211
|
+
Enabled: false # To be decided
|
212
|
+
|
213
|
+
RSpec/ExpectInHook:
|
214
|
+
Enabled: false # To be decided
|
215
|
+
|
216
|
+
RSpec/ExpectOutput:
|
217
|
+
Enabled: true
|
218
|
+
|
219
|
+
RSpec/FilePath:
|
220
|
+
Enabled: false # To be decided
|
221
|
+
|
222
|
+
RSpec/Focus:
|
223
|
+
Enabled: true
|
224
|
+
|
225
|
+
RSpec/HookArgument:
|
226
|
+
Enabled: false # TODO
|
227
|
+
|
228
|
+
RSpec/HooksBeforeExamples:
|
229
|
+
Enabled: false # TODO
|
230
|
+
|
231
|
+
RSpec/ImplicitBlockExpectation:
|
232
|
+
Enabled: true
|
233
|
+
|
234
|
+
RSpec/ImplicitExpect:
|
235
|
+
Enabled: false # To be decided
|
236
|
+
|
237
|
+
RSpec/ImplicitSubject:
|
238
|
+
Enabled: false # To be decided
|
239
|
+
|
240
|
+
RSpec/InstanceSpy:
|
241
|
+
Enabled: true
|
242
|
+
|
243
|
+
RSpec/InstanceVariable:
|
244
|
+
Enabled: false # TODO
|
245
|
+
|
246
|
+
RSpec/InvalidPredicateMatcher:
|
247
|
+
Enabled: true
|
248
|
+
|
249
|
+
RSpec/ItBehavesLike:
|
250
|
+
Enabled: true
|
251
|
+
|
252
|
+
RSpec/IteratedExpectation:
|
253
|
+
Enabled: false # To be decided
|
254
|
+
|
255
|
+
RSpec/LeadingSubject:
|
256
|
+
Enabled: false # TODO
|
257
|
+
|
258
|
+
RSpec/LeakyConstantDeclaration:
|
259
|
+
Enabled: false # To be decided
|
260
|
+
|
261
|
+
RSpec/LetBeforeExamples:
|
262
|
+
Enabled: false # TODO
|
263
|
+
|
264
|
+
RSpec/LetSetup:
|
265
|
+
Enabled: false # TODO
|
266
|
+
|
267
|
+
RSpec/MessageChain:
|
268
|
+
Enabled: true
|
269
|
+
|
270
|
+
RSpec/MessageSpies:
|
271
|
+
Enabled: true
|
272
|
+
|
273
|
+
RSpec/MissingExampleGroupArgument:
|
274
|
+
Enabled: true
|
275
|
+
|
276
|
+
RSpec/MultipleDescribes:
|
277
|
+
Enabled: false # TODO
|
278
|
+
|
279
|
+
RSpec/MultipleSubjects:
|
280
|
+
Enabled: true
|
281
|
+
|
282
|
+
RSpec/NamedSubject:
|
283
|
+
Enabled: false # To be decided
|
284
|
+
|
285
|
+
RSpec/NestedGroups:
|
286
|
+
Enabled: false # To be decided
|
287
|
+
|
288
|
+
RSpec/OverwritingSetup:
|
289
|
+
Enabled: true
|
290
|
+
|
291
|
+
RSpec/ReceiveCounts:
|
292
|
+
Enabled: true
|
293
|
+
|
294
|
+
RSpec/ReceiveNever:
|
295
|
+
Enabled: true
|
296
|
+
|
297
|
+
RSpec/RepeatedDescription:
|
298
|
+
Enabled: false # TODO
|
299
|
+
|
300
|
+
RSpec/RepeatedExample:
|
301
|
+
Enabled: false # TODO
|
302
|
+
|
303
|
+
RSpec/RepeatedExampleGroupBody:
|
304
|
+
Enabled: false # TODO
|
305
|
+
|
306
|
+
RSpec/RepeatedExampleGroupDescription:
|
307
|
+
Enabled: false # TODO
|
308
|
+
|
309
|
+
RSpec/ReturnFromStub:
|
310
|
+
Enabled: true
|
311
|
+
|
312
|
+
RSpec/ScatteredSetup:
|
313
|
+
Enabled: false # TODO
|
314
|
+
|
315
|
+
RSpec/SharedContext:
|
316
|
+
Enabled: true
|
317
|
+
|
318
|
+
RSpec/SharedExamples:
|
319
|
+
Enabled: true
|
320
|
+
|
321
|
+
RSpec/SingleArgumentMessageChain:
|
322
|
+
Enabled: true
|
323
|
+
|
324
|
+
RSpec/SubjectStub:
|
325
|
+
Enabled: true
|
326
|
+
|
327
|
+
RSpec/UnspecifiedException:
|
328
|
+
Enabled: true
|
329
|
+
|
330
|
+
RSpec/VerifiedDoubles:
|
331
|
+
Enabled: true
|
332
|
+
|
333
|
+
RSpec/VoidExpect:
|
334
|
+
Enabled: true
|
335
|
+
|
336
|
+
RSpec/Yield:
|
337
|
+
Enabled: true
|
338
|
+
|
339
|
+
Capybara/CurrentPathExpectation:
|
340
|
+
Enabled: true
|
341
|
+
|
342
|
+
Capybara/FeatureMethods:
|
343
|
+
Enabled: true
|
344
|
+
|
345
|
+
FactoryBot/AttributeDefinedStatically:
|
346
|
+
Enabled: true
|
347
|
+
|
348
|
+
FactoryBot/CreateList:
|
349
|
+
Enabled: true
|
350
|
+
|
351
|
+
FactoryBot/FactoryClassName:
|
352
|
+
Enabled: true
|
353
|
+
|
354
|
+
Rails/HttpStatus:
|
355
|
+
Enabled: true
|
data/.rubocop.yml
ADDED
data/CHANGELOG
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
2020-12-30 - 1.0
|
2
|
+
|
3
|
+
- Added serialization support using MiniSql::Serializer.to_json / .from_json
|
4
|
+
- Fixed minor issue with cache poisoning when using query_decorator
|
5
|
+
- Version 1.0 to reflect the stability of the interfaces and project, used in productions for almost 2 years now
|
6
|
+
|
7
|
+
2020-06-25 - 0.3
|
8
|
+
|
9
|
+
- Added support for query_each and query_each_hash, which lazily queries rows and enables selecting large result sets by streaming
|
10
|
+
|
11
|
+
2020-04-07 - 0.2.5
|
12
|
+
|
13
|
+
- Added support for custom type maps with Postgres connections
|
14
|
+
|
15
|
+
2019-01-16 - 0.2.4
|
16
|
+
|
17
|
+
- Fixed symbol param encoder
|
18
|
+
|
19
|
+
2019-12-20 - 0.2.3
|
20
|
+
|
21
|
+
- Added support for MySQL
|
22
|
+
|
1
23
|
2019-11-04 - 0.2.2
|
2
24
|
|
3
25
|
- Added adapters for JRuby postgres support thanks to @enebo
|