stairwell 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +32 -19
- data/README.md +7 -1
- data/lib/stairwell/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e963ad4c2388946d0baae50090e6f3e9913e49dcdd896cdd18403861d72b9a40
|
4
|
+
data.tar.gz: 29cb2a589732e6e4b0b43115da878d8b4463eb59a1ad46726d01595bc0f56f19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d21bd2ad1fc8a8b04de7da744dae787a474a33fbb42146a4b77d218d5ee493c25ed930da39b23a4ce45a67448920924e5d2a4006ba62978422caf3c43156395
|
7
|
+
data.tar.gz: 229bc47578fea9e530d10291d79d94bcd042222e767f5627b45e4b7867af09e76958a34b9d4208b6763c1d89fcea5399317ad6c4047c547e2bae11e62361f61c
|
data/Gemfile.lock
CHANGED
@@ -1,39 +1,52 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stairwell (0.
|
4
|
+
stairwell (0.3.0)
|
5
5
|
activerecord (>= 4.2.11)
|
6
6
|
sqlite3
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (
|
12
|
-
activesupport (=
|
13
|
-
activerecord (
|
14
|
-
activemodel (=
|
15
|
-
activesupport (=
|
16
|
-
|
11
|
+
activemodel (7.1.1)
|
12
|
+
activesupport (= 7.1.1)
|
13
|
+
activerecord (7.1.1)
|
14
|
+
activemodel (= 7.1.1)
|
15
|
+
activesupport (= 7.1.1)
|
16
|
+
timeout (>= 0.4.0)
|
17
|
+
activesupport (7.1.1)
|
18
|
+
base64
|
19
|
+
bigdecimal
|
17
20
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
connection_pool (>= 2.2.5)
|
22
|
+
drb
|
23
|
+
i18n (>= 1.6, < 2)
|
24
|
+
minitest (>= 5.1)
|
25
|
+
mutex_m
|
26
|
+
tzinfo (~> 2.0)
|
27
|
+
base64 (0.1.1)
|
28
|
+
bigdecimal (3.1.4)
|
22
29
|
coderay (1.1.3)
|
23
|
-
concurrent-ruby (1.
|
24
|
-
|
30
|
+
concurrent-ruby (1.2.2)
|
31
|
+
connection_pool (2.4.1)
|
32
|
+
drb (2.1.1)
|
33
|
+
ruby2_keywords
|
34
|
+
i18n (1.14.1)
|
25
35
|
concurrent-ruby (~> 1.0)
|
26
36
|
method_source (1.0.0)
|
27
|
-
|
37
|
+
mini_portile2 (2.8.5)
|
38
|
+
minitest (5.20.0)
|
39
|
+
mutex_m (0.1.2)
|
28
40
|
pry (0.13.1)
|
29
41
|
coderay (~> 1.1)
|
30
42
|
method_source (~> 1.0)
|
31
43
|
rake (12.3.3)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
44
|
+
ruby2_keywords (0.0.5)
|
45
|
+
sqlite3 (1.6.7)
|
46
|
+
mini_portile2 (~> 2.8.0)
|
47
|
+
timeout (0.4.0)
|
48
|
+
tzinfo (2.0.6)
|
49
|
+
concurrent-ruby (~> 1.0)
|
37
50
|
|
38
51
|
PLATFORMS
|
39
52
|
ruby
|
data/README.md
CHANGED
@@ -18,6 +18,12 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install stairwell
|
20
20
|
|
21
|
+
## Why?
|
22
|
+
Although ActiveRecord serves as an excellent tool for the majority of database queries, certain scenarios call for more customized queries.
|
23
|
+
This project was initially conceived to help transition a development team and their project from PHP to Ruby. This PHP project had thousands of complex SQL queries, thus the necessity of making SQL a first-class citizen in the ruby project enabled a smoother transition.
|
24
|
+
So, why not Arel? Arel is a powerful tool, but it's worth noting that it is considered a private API and is likely to remain so for the forseeable future.
|
25
|
+
Does this approach make queries less composable? Yes, if you are used to chaining your arel queries and AR scopes then you're probably not going to use this. However, it provides an interface that enables you to leverage SQL securely in your Ruby projects without the need to reinvent the wheel.
|
26
|
+
|
21
27
|
## Usage
|
22
28
|
|
23
29
|
Define a class in your app that inherits from `Stairwell::Query`. We're going to assume you are in a rails app, but this will work in any ruby app, although ActiveRecord is a dependency of this gem.
|
@@ -57,7 +63,7 @@ binds = {
|
|
57
63
|
name: "First",
|
58
64
|
age: 99,
|
59
65
|
active: true,
|
60
|
-
gpa: 4.2
|
66
|
+
gpa: 4.2,
|
61
67
|
date_joined: "2008-08-28",
|
62
68
|
created_at: "2008-08-28 23:41:18",
|
63
69
|
favorite_numbers: [4, 7, 100]
|
data/lib/stairwell/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stairwell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tobyond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
|
-
rubygems_version: 3.
|
94
|
+
rubygems_version: 3.4.10
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: stairwell for sql
|