sql_runner 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/.github/FUNDING.yml +3 -0
- data/.rubocop.yml +10 -0
- data/README.md +44 -9
- data/Rakefile +4 -1
- data/examples/base.rb +96 -0
- data/examples/test.rb +1 -86
- data/examples/test_active_record.rb +17 -0
- data/lib/sql_runner/adapters/active_record.rb +63 -0
- data/lib/sql_runner/adapters/mysql.rb +12 -4
- data/lib/sql_runner/adapters/postgresql.rb +9 -2
- data/lib/sql_runner/adapters.rb +1 -0
- data/lib/sql_runner/configuration.rb +1 -3
- data/lib/sql_runner/connection.rb +5 -3
- data/lib/sql_runner/query/one.rb +1 -1
- data/lib/sql_runner/query.rb +1 -0
- data/lib/sql_runner/runner.rb +2 -2
- data/lib/sql_runner/version.rb +1 -1
- data/lib/sql_runner.rb +1 -0
- data/sql_runner.gemspec +6 -1
- metadata +55 -9
- data/Gemfile.lock +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89e2f8d25ad8e55c06aae24d62af47733867213d933cfcf7649f17c917d6e019
|
4
|
+
data.tar.gz: 51ec63734cb7665e87e5a31c3c2ec02c943d6773d5ecfdd1a2d2762a761ac207
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e3f6c4efa3b0ebaa7fb53016fe35f4a1948d228491b52e0b7648e31298d29bb96fc267416d93f11973da6c2008ef80d199c07ea62ba2861649a002a110d0f33
|
7
|
+
data.tar.gz: c62db307f7c62a358fd2c0113ace57b221cb800987290034d2b7c7c09aaef20454efdae92411c164a78ed2ab2560020a4cbf059a8b74fb9db945f454abfd196a
|
data/.github/FUNDING.yml
ADDED
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,8 @@
|
|
6
6
|
[![Gem](https://img.shields.io/gem/v/sql_runner.svg)](https://rubygems.org/gems/sql_runner)
|
7
7
|
[![Gem](https://img.shields.io/gem/dt/sql_runner.svg)](https://rubygems.org/gems/sql_runner)
|
8
8
|
|
9
|
-
SQLRunner allows you to load your queries out of SQL files, without using ORMs.
|
9
|
+
SQLRunner allows you to load your queries out of SQL files, without using ORMs.
|
10
|
+
Available for PostgreSQL and MySQL.
|
10
11
|
|
11
12
|
## Installation
|
12
13
|
|
@@ -76,6 +77,22 @@ class GetMembers < SQLRunner::Query
|
|
76
77
|
end
|
77
78
|
```
|
78
79
|
|
80
|
+
You can use this with ActiveRecord as well. To make it work, all you need to do
|
81
|
+
is establishing the connection using `activerecord:///`:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
require "active_record"
|
85
|
+
|
86
|
+
# You probably won't need this if you're using Rails.
|
87
|
+
ActiveRecord::Base.establish_connection("postgresql:///database")
|
88
|
+
|
89
|
+
# Set the adapter to be based on ActiveRecord.
|
90
|
+
SQLRunner.connect "activerecord:///"
|
91
|
+
|
92
|
+
SQLRunner.execute "SELECT 1"
|
93
|
+
#=> <PG:Result:0x008adf4d5495b0>
|
94
|
+
```
|
95
|
+
|
79
96
|
### Plugins
|
80
97
|
|
81
98
|
#### Load just one record
|
@@ -133,7 +150,9 @@ FindUsers.call
|
|
133
150
|
|
134
151
|
### Adding new plugins
|
135
152
|
|
136
|
-
First you have to create a class/module that implements the
|
153
|
+
First you have to create a class/module that implements the
|
154
|
+
`.activate(target, options)` class method. The following example overrides the
|
155
|
+
`call(**bind_vars)` method by using `Module.prepend`.
|
137
156
|
|
138
157
|
```ruby
|
139
158
|
module ReverseRecords
|
@@ -147,7 +166,7 @@ module ReverseRecords
|
|
147
166
|
end
|
148
167
|
```
|
149
168
|
|
150
|
-
|
169
|
+
#### Register the plugin.
|
151
170
|
|
152
171
|
```ruby
|
153
172
|
SQLRunner::Query.register_plugin :reverse, ReverseRecords
|
@@ -160,11 +179,17 @@ end
|
|
160
179
|
Users.call
|
161
180
|
```
|
162
181
|
|
163
|
-
If your plugin can receive options, you can call it as
|
182
|
+
If your plugin can receive options, you can call it as
|
183
|
+
`plugin reverse: options`, where `options` can be anything (e.g. `Hash`,
|
184
|
+
`Array`, `Object`, etc).
|
164
185
|
|
165
186
|
## Benchmarks
|
166
187
|
|
167
|
-
You won't gain too much performance by using this gem.
|
188
|
+
You won't gain too much performance by using this gem. The idea is making SQL
|
189
|
+
easier to read by extracting complex stuff to their own files. These are the
|
190
|
+
results against ActiveRecord using different wrapping libraries like
|
191
|
+
[virtus](https://rubygems.org/gems/virtus) and
|
192
|
+
[dry-types](https://rubygems.org/gems/dry-types).
|
168
193
|
|
169
194
|
Loading just one record:
|
170
195
|
|
@@ -186,14 +211,24 @@ activerecord - find many : 2731.5 i/s - 2.49x slower
|
|
186
211
|
|
187
212
|
## Development
|
188
213
|
|
189
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
214
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
215
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
216
|
+
prompt that will allow you to experiment.
|
190
217
|
|
191
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To
|
218
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
219
|
+
release a new version, update the version number in `version.rb`, and then run
|
220
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
221
|
+
git commits and tags, and push the `.gem` file to
|
222
|
+
[rubygems.org](https://rubygems.org).
|
192
223
|
|
193
224
|
## Contributing
|
194
225
|
|
195
|
-
Bug reports and pull requests are welcome on GitHub at
|
226
|
+
Bug reports and pull requests are welcome on GitHub at
|
227
|
+
https://github.com/fnando/sql_runner. This project is intended to be a safe,
|
228
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
229
|
+
the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
196
230
|
|
197
231
|
## License
|
198
232
|
|
199
|
-
The gem is available as open source under the terms of the
|
233
|
+
The gem is available as open source under the terms of the
|
234
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
4
|
require "rake/testtask"
|
5
|
+
require "rubocop/rake_task"
|
5
6
|
|
6
7
|
Rake::TestTask.new(:test) do |t|
|
7
8
|
t.libs << "test"
|
@@ -10,4 +11,6 @@ Rake::TestTask.new(:test) do |t|
|
|
10
11
|
t.warning = false
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
data/examples/base.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
SQLRunner.execute <<~SQL
|
4
|
+
create table if not exists users (
|
5
|
+
id serial primary key not null,
|
6
|
+
name text not null,
|
7
|
+
email text not null
|
8
|
+
)
|
9
|
+
SQL
|
10
|
+
|
11
|
+
class Users < SQLRunner::Query
|
12
|
+
end
|
13
|
+
|
14
|
+
module NumericModel
|
15
|
+
def self.new(attrs)
|
16
|
+
attrs.values.first.to_i
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Numbers < SQLRunner::Query
|
21
|
+
plugin model: NumericModel
|
22
|
+
plugin :many
|
23
|
+
|
24
|
+
query <<-SQL
|
25
|
+
SELECT n FROM generate_series(1, 10) n
|
26
|
+
SQL
|
27
|
+
end
|
28
|
+
|
29
|
+
class User
|
30
|
+
include Virtus.model
|
31
|
+
|
32
|
+
attribute :id, String
|
33
|
+
attribute :name, String
|
34
|
+
attribute :email, Integer
|
35
|
+
end
|
36
|
+
|
37
|
+
class Customer < User
|
38
|
+
end
|
39
|
+
|
40
|
+
class FindUser < SQLRunner::Query
|
41
|
+
plugins :one
|
42
|
+
plugin model: User
|
43
|
+
end
|
44
|
+
|
45
|
+
class FindAllUsers < SQLRunner::Query
|
46
|
+
plugins :many
|
47
|
+
plugin model: User
|
48
|
+
end
|
49
|
+
|
50
|
+
class CreateUser < SQLRunner::Query
|
51
|
+
plugin :one
|
52
|
+
plugin model: User
|
53
|
+
end
|
54
|
+
|
55
|
+
class DeleteAllUsers < SQLRunner::Query
|
56
|
+
plugin :many
|
57
|
+
plugin model: User
|
58
|
+
end
|
59
|
+
|
60
|
+
class FindCustomer < SQLRunner::Query
|
61
|
+
query_name "find_user"
|
62
|
+
plugin :one
|
63
|
+
plugin model: Customer
|
64
|
+
end
|
65
|
+
|
66
|
+
result = SQLRunner.execute(
|
67
|
+
"select application_name from pg_stat_activity where pid = pg_backend_pid();"
|
68
|
+
)
|
69
|
+
p [:application_name, result.to_a]
|
70
|
+
|
71
|
+
result = SQLRunner.execute <<~SQL, name: "john", age: 18
|
72
|
+
select
|
73
|
+
'hello'::text as message,
|
74
|
+
:name::text as name,
|
75
|
+
:age::integer as age,
|
76
|
+
:name::text as name2
|
77
|
+
SQL
|
78
|
+
p [:select, result.to_a]
|
79
|
+
|
80
|
+
p [:delete_all_users, DeleteAllUsers.call]
|
81
|
+
p [:create_user, CreateUser.call(name: "Nando Vieira", email: "me@fnando.com")]
|
82
|
+
p [:create_user, CreateUser.call(name: "John Doe", email: "john@example.com")]
|
83
|
+
p [:numbers, Numbers.call]
|
84
|
+
p [:users, Users.call.to_a]
|
85
|
+
p [:find_user, FindUser.call(email: "me@fnando.com")]
|
86
|
+
p [:find_user, FindUser.call(email: "' OR 1=1 --me@fnando.com")]
|
87
|
+
p [:find_user, FindUser.call!(email: "me@fnando.com")]
|
88
|
+
p [:find_customer, FindCustomer.call!(email: "me@fnando.com")]
|
89
|
+
|
90
|
+
begin
|
91
|
+
FindUser.call!(email: "invalid@email")
|
92
|
+
rescue SQLRunner::RecordNotFound => error
|
93
|
+
p [:find_user, error]
|
94
|
+
end
|
95
|
+
|
96
|
+
SQLRunner.disconnect
|
data/examples/test.rb
CHANGED
@@ -9,89 +9,4 @@ SQLRunner.pool = 25
|
|
9
9
|
SQLRunner.timeout = 10
|
10
10
|
SQLRunner.root_dir = "#{__dir__}/sql"
|
11
11
|
|
12
|
-
|
13
|
-
"select application_name from pg_stat_activity where pid = pg_backend_pid();"
|
14
|
-
)
|
15
|
-
p result.to_a
|
16
|
-
|
17
|
-
result = SQLRunner.execute <<~SQL, name: "john", age: 18
|
18
|
-
select
|
19
|
-
'hello'::text as message,
|
20
|
-
:name::text as name,
|
21
|
-
:age::integer as age,
|
22
|
-
:name::text as name2
|
23
|
-
SQL
|
24
|
-
p result.to_a
|
25
|
-
|
26
|
-
class Users < SQLRunner::Query
|
27
|
-
end
|
28
|
-
|
29
|
-
module NumericModel
|
30
|
-
def self.new(attrs)
|
31
|
-
attrs.values.first.to_i
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
class Numbers < SQLRunner::Query
|
36
|
-
plugin model: NumericModel
|
37
|
-
plugin :many
|
38
|
-
|
39
|
-
query <<-SQL
|
40
|
-
SELECT n FROM generate_series(1, 10) n
|
41
|
-
SQL
|
42
|
-
end
|
43
|
-
|
44
|
-
class User
|
45
|
-
include Virtus.model
|
46
|
-
|
47
|
-
attribute :id, String
|
48
|
-
attribute :name, String
|
49
|
-
attribute :email, Integer
|
50
|
-
end
|
51
|
-
|
52
|
-
class Customer < User
|
53
|
-
end
|
54
|
-
|
55
|
-
class FindUser < SQLRunner::Query
|
56
|
-
plugins :one
|
57
|
-
plugin model: User
|
58
|
-
end
|
59
|
-
|
60
|
-
class FindAllUsers < SQLRunner::Query
|
61
|
-
plugins :many
|
62
|
-
plugin model: User
|
63
|
-
end
|
64
|
-
|
65
|
-
class CreateUser < SQLRunner::Query
|
66
|
-
plugin :one
|
67
|
-
plugin model: User
|
68
|
-
end
|
69
|
-
|
70
|
-
class DeleteAllUsers < SQLRunner::Query
|
71
|
-
plugin :many
|
72
|
-
plugin model: User
|
73
|
-
end
|
74
|
-
|
75
|
-
class FindCustomer < SQLRunner::Query
|
76
|
-
query_name "find_user"
|
77
|
-
plugin model: Customer
|
78
|
-
plugins :one
|
79
|
-
end
|
80
|
-
|
81
|
-
p DeleteAllUsers.call
|
82
|
-
p CreateUser.call(name: "Nando Vieira", email: "me@fnando.com")
|
83
|
-
p CreateUser.call(name: "John Doe", email: "john@example.com")
|
84
|
-
p Numbers.call
|
85
|
-
p Users.call.to_a
|
86
|
-
p FindUser.call(email: "me@fnando.com")
|
87
|
-
p FindUser.call(email: "' OR 1=1 --me@fnando.com")
|
88
|
-
p FindUser.call!(email: "me@fnando.com")
|
89
|
-
p FindCustomer.call!(email: "me@fnando.com")
|
90
|
-
|
91
|
-
begin
|
92
|
-
FindUser.call!(email: "me@fnando.coms")
|
93
|
-
rescue SQLRunner::RecordNotFound => e
|
94
|
-
p e
|
95
|
-
end
|
96
|
-
|
97
|
-
SQLRunner.disconnect
|
12
|
+
require_relative "base"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path("#{__dir__}/../lib")
|
4
|
+
require "sql_runner"
|
5
|
+
require "virtus"
|
6
|
+
require "active_record"
|
7
|
+
|
8
|
+
ActiveRecord::Base.establish_connection(
|
9
|
+
"postgres:///test?connect_timeout=2&application_name=myapp"
|
10
|
+
)
|
11
|
+
|
12
|
+
SQLRunner.connect "activerecord:///"
|
13
|
+
SQLRunner.pool = 25
|
14
|
+
SQLRunner.timeout = 10
|
15
|
+
SQLRunner.root_dir = "#{__dir__}/sql"
|
16
|
+
|
17
|
+
require_relative "base"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SQLRunner
|
4
|
+
module Adapters
|
5
|
+
class ActiveRecord
|
6
|
+
class PostgreSQL < SQLRunner::Adapters::PostgreSQL
|
7
|
+
def initialize(connection) # rubocop:disable Lint/MissingSuper
|
8
|
+
@connection = connection
|
9
|
+
end
|
10
|
+
|
11
|
+
def connect(*)
|
12
|
+
end
|
13
|
+
|
14
|
+
def disconnect(*)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class MySQL < SQLRunner::Adapters::MySQL
|
19
|
+
def initialize(connection) # rubocop:disable Lint/MissingSuper
|
20
|
+
@connection = connection
|
21
|
+
end
|
22
|
+
|
23
|
+
def connect(*)
|
24
|
+
end
|
25
|
+
|
26
|
+
def disconnect(*)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class ConnectionPool
|
31
|
+
def with
|
32
|
+
::ActiveRecord::Base.connection_pool.with_connection do |connection|
|
33
|
+
connection = connection.instance_variable_get(:@connection)
|
34
|
+
|
35
|
+
adapter = case connection.class.name
|
36
|
+
when "PG::Connection"
|
37
|
+
PostgreSQL.new(connection)
|
38
|
+
when "Mysql2::Client"
|
39
|
+
MySQL.new(connection)
|
40
|
+
else
|
41
|
+
raise UnsupportedDatabase
|
42
|
+
end
|
43
|
+
|
44
|
+
yield(adapter)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def shutdown
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.load
|
53
|
+
require "active_record"
|
54
|
+
rescue LoadError
|
55
|
+
raise MissingDependency, "make sure the `activerecord` gem is available"
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.create_connection_pool(*)
|
59
|
+
ConnectionPool.new
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -11,6 +11,12 @@ module SQLRunner
|
|
11
11
|
raise MissingDependency, "make sure the `mysql2` gem is available"
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.create_connection_pool(timeout:, size:, connection_string:)
|
15
|
+
ConnectionPool.new(timeout: timeout, size: size) do
|
16
|
+
new(connection_string)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
14
20
|
def initialize(connection_string)
|
15
21
|
@connection_string = connection_string
|
16
22
|
@uri = URI.parse(@connection_string)
|
@@ -48,10 +54,12 @@ module SQLRunner
|
|
48
54
|
validate_bindings(query, bind_vars, names)
|
49
55
|
|
50
56
|
statement = @connection.prepare(bound_query)
|
51
|
-
statement.execute(
|
52
|
-
|
53
|
-
|
54
|
-
|
57
|
+
statement.execute(
|
58
|
+
*bindings,
|
59
|
+
cast: true,
|
60
|
+
as: :hash,
|
61
|
+
cast_booleans: true
|
62
|
+
)
|
55
63
|
end
|
56
64
|
|
57
65
|
def active?
|
@@ -11,6 +11,12 @@ module SQLRunner
|
|
11
11
|
raise MissingDependency, "make sure the `pg` gem is available"
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.create_connection_pool(timeout:, size:, connection_string:)
|
15
|
+
ConnectionPool.new(timeout: timeout, size: size) do
|
16
|
+
new(connection_string)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
14
20
|
def initialize(connection_string)
|
15
21
|
@connection_string = connection_string
|
16
22
|
connect
|
@@ -59,12 +65,13 @@ module SQLRunner
|
|
59
65
|
to_s
|
60
66
|
end
|
61
67
|
|
62
|
-
def parse(query)
|
68
|
+
def parse(query)
|
63
69
|
bindings = {}
|
64
70
|
count = 0
|
65
71
|
|
66
72
|
parsed_query = query.gsub(/(:?):([a-zA-Z]\w*)/) do |match|
|
67
|
-
|
73
|
+
# skip type casting
|
74
|
+
next match if Regexp.last_match(1) == ":"
|
68
75
|
|
69
76
|
name = match[1..-1]
|
70
77
|
sym_name = name.to_sym
|
data/lib/sql_runner/adapters.rb
CHANGED
@@ -6,9 +6,11 @@ module SQLRunner
|
|
6
6
|
uri = URI.parse(connection_string)
|
7
7
|
adapter = Adapters.find(uri.scheme)
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
adapter.create_connection_pool(
|
10
|
+
timeout: SQLRunner.timeout,
|
11
|
+
size: SQLRunner.pool,
|
12
|
+
connection_string: connection_string
|
13
|
+
)
|
12
14
|
end
|
13
15
|
|
14
16
|
def with_connection(&block)
|
data/lib/sql_runner/query/one.rb
CHANGED
data/lib/sql_runner/query.rb
CHANGED
data/lib/sql_runner/runner.rb
CHANGED
data/lib/sql_runner/version.rb
CHANGED
data/lib/sql_runner.rb
CHANGED
@@ -17,6 +17,7 @@ module SQLRunner
|
|
17
17
|
extend Configuration
|
18
18
|
extend Runner
|
19
19
|
|
20
|
+
Adapters.register("activerecord", Adapters::ActiveRecord)
|
20
21
|
Adapters.register("postgres", Adapters::PostgreSQL)
|
21
22
|
Adapters.register("postgresql", Adapters::PostgreSQL)
|
22
23
|
Adapters.register("mysql", Adapters::MySQL)
|
data/sql_runner.gemspec
CHANGED
@@ -7,8 +7,10 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = SQLRunner::VERSION
|
8
8
|
spec.authors = ["Nando Vieira"]
|
9
9
|
spec.email = ["me@fnando.com"]
|
10
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
11
|
+
spec.metadata = {"rubygems_mfa_required" => "true"}
|
10
12
|
|
11
|
-
spec.summary
|
13
|
+
spec.summary = <<~TEXT.tr("\n", " ")
|
12
14
|
SQLRunner allows you to load your queries out of SQL files, without using
|
13
15
|
ORMs.
|
14
16
|
TEXT
|
@@ -26,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
26
28
|
|
27
29
|
spec.add_dependency "connection_pool"
|
28
30
|
|
31
|
+
spec.add_development_dependency "activerecord"
|
29
32
|
spec.add_development_dependency "bundler"
|
30
33
|
spec.add_development_dependency "minitest-utils"
|
31
34
|
spec.add_development_dependency "mocha"
|
@@ -33,5 +36,7 @@ Gem::Specification.new do |spec|
|
|
33
36
|
spec.add_development_dependency "pg"
|
34
37
|
spec.add_development_dependency "pry-meta"
|
35
38
|
spec.add_development_dependency "rake"
|
39
|
+
spec.add_development_dependency "rubocop"
|
40
|
+
spec.add_development_dependency "rubocop-fnando"
|
36
41
|
spec.add_development_dependency "simplecov"
|
37
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sql_runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activerecord
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,34 @@ dependencies:
|
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-fnando
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
125
167
|
- !ruby/object:Gem::Dependency
|
126
168
|
name: simplecov
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,17 +186,18 @@ executables: []
|
|
144
186
|
extensions: []
|
145
187
|
extra_rdoc_files: []
|
146
188
|
files:
|
189
|
+
- ".github/FUNDING.yml"
|
147
190
|
- ".gitignore"
|
148
191
|
- ".rubocop.yml"
|
149
192
|
- ".travis.yml"
|
150
193
|
- CODE_OF_CONDUCT.md
|
151
194
|
- Gemfile
|
152
|
-
- Gemfile.lock
|
153
195
|
- LICENSE.txt
|
154
196
|
- README.md
|
155
197
|
- Rakefile
|
156
198
|
- bin/console
|
157
199
|
- bin/setup
|
200
|
+
- examples/base.rb
|
158
201
|
- examples/bench.rb
|
159
202
|
- examples/profiling.rb
|
160
203
|
- examples/sql/create_user.sql
|
@@ -162,8 +205,10 @@ files:
|
|
162
205
|
- examples/sql/find_user.sql
|
163
206
|
- examples/sql/users.sql
|
164
207
|
- examples/test.rb
|
208
|
+
- examples/test_active_record.rb
|
165
209
|
- lib/sql_runner.rb
|
166
210
|
- lib/sql_runner/adapters.rb
|
211
|
+
- lib/sql_runner/adapters/active_record.rb
|
167
212
|
- lib/sql_runner/adapters/mysql.rb
|
168
213
|
- lib/sql_runner/adapters/postgresql.rb
|
169
214
|
- lib/sql_runner/configuration.rb
|
@@ -178,8 +223,9 @@ files:
|
|
178
223
|
homepage: https://github.com/fnando/sql_runner
|
179
224
|
licenses:
|
180
225
|
- MIT
|
181
|
-
metadata:
|
182
|
-
|
226
|
+
metadata:
|
227
|
+
rubygems_mfa_required: 'true'
|
228
|
+
post_install_message:
|
183
229
|
rdoc_options: []
|
184
230
|
require_paths:
|
185
231
|
- lib
|
@@ -187,15 +233,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
233
|
requirements:
|
188
234
|
- - ">="
|
189
235
|
- !ruby/object:Gem::Version
|
190
|
-
version:
|
236
|
+
version: 2.6.0
|
191
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
238
|
requirements:
|
193
239
|
- - ">="
|
194
240
|
- !ruby/object:Gem::Version
|
195
241
|
version: '0'
|
196
242
|
requirements: []
|
197
|
-
rubygems_version: 3.
|
198
|
-
signing_key:
|
243
|
+
rubygems_version: 3.3.7
|
244
|
+
signing_key:
|
199
245
|
specification_version: 4
|
200
246
|
summary: SQLRunner allows you to load your queries out of SQL files, without using
|
201
247
|
ORMs.
|
data/Gemfile.lock
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
sql_runner (0.2.0)
|
5
|
-
connection_pool
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
awesome_print (1.8.0)
|
11
|
-
byebug (11.0.1)
|
12
|
-
coderay (1.1.2)
|
13
|
-
connection_pool (2.2.2)
|
14
|
-
docile (1.3.2)
|
15
|
-
json (2.3.0)
|
16
|
-
method_source (0.9.2)
|
17
|
-
minitest (5.14.0)
|
18
|
-
minitest-utils (0.4.6)
|
19
|
-
minitest
|
20
|
-
mocha (1.11.2)
|
21
|
-
mysql2 (0.5.3)
|
22
|
-
pg (1.2.2)
|
23
|
-
pry (0.12.2)
|
24
|
-
coderay (~> 1.1.0)
|
25
|
-
method_source (~> 0.9.0)
|
26
|
-
pry-byebug (3.7.0)
|
27
|
-
byebug (~> 11.0)
|
28
|
-
pry (~> 0.10)
|
29
|
-
pry-meta (0.0.10)
|
30
|
-
awesome_print
|
31
|
-
pry
|
32
|
-
pry-byebug
|
33
|
-
pry-remote
|
34
|
-
pry-remote (0.1.8)
|
35
|
-
pry (~> 0.9)
|
36
|
-
slop (~> 3.0)
|
37
|
-
rake (13.0.1)
|
38
|
-
simplecov (0.17.1)
|
39
|
-
docile (~> 1.1)
|
40
|
-
json (>= 1.8, < 3)
|
41
|
-
simplecov-html (~> 0.10.0)
|
42
|
-
simplecov-html (0.10.2)
|
43
|
-
slop (3.6.0)
|
44
|
-
|
45
|
-
PLATFORMS
|
46
|
-
ruby
|
47
|
-
|
48
|
-
DEPENDENCIES
|
49
|
-
bundler
|
50
|
-
minitest-utils
|
51
|
-
mocha
|
52
|
-
mysql2
|
53
|
-
pg
|
54
|
-
pry-meta
|
55
|
-
rake
|
56
|
-
simplecov
|
57
|
-
sql_runner!
|
58
|
-
|
59
|
-
BUNDLED WITH
|
60
|
-
2.1.2
|