yesql 0.1.5 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -22
- data/lib/.rbnext/2.3/yesql/errors/file_path_does_not_exist_error.rb +40 -0
- data/lib/.rbnext/2.3/yesql/errors/no_bindings_provided_error.rb +38 -0
- data/lib/.rbnext/2.3/yesql/errors/output_argument_error.rb +31 -0
- data/lib/.rbnext/2.3/yesql/query/transform_result.rb +48 -0
- data/lib/.rbnext/2.7/yesql/bindings/extract.rb +71 -0
- data/lib/.rbnext/2.7/yesql/bindings/extractor.rb +38 -0
- data/lib/.rbnext/2.7/yesql/bindings/transformed.rb +58 -0
- data/lib/.rbnext/2.7/yesql/bindings/utils.rb +16 -0
- data/lib/.rbnext/2.7/yesql/errors/file_path_does_not_exist_error.rb +43 -0
- data/lib/.rbnext/2.7/yesql/errors/no_bindings_provided_error.rb +41 -0
- data/lib/.rbnext/2.7/yesql/query/transform_result.rb +48 -0
- data/lib/.rbnext/2.7/yesql/statement.rb +44 -0
- data/lib/.rbnext/2.7/yesql/utils/read.rb +20 -0
- data/lib/.rbnext/3.0/yesql/bindings/extract.rb +71 -0
- data/lib/.rbnext/3.0/yesql/bindings/transformed.rb +58 -0
- data/lib/.rbnext/3.0/yesql/common/adapter.rb +18 -0
- data/lib/.rbnext/3.0/yesql/config/configuration.rb +32 -0
- data/lib/.rbnext/3.0/yesql/errors/file_path_does_not_exist_error.rb +43 -0
- data/lib/.rbnext/3.0/yesql/errors/no_bindings_provided_error.rb +41 -0
- data/lib/.rbnext/3.0/yesql/params/output.rb +26 -0
- data/lib/.rbnext/3.0/yesql/query/performer.rb +44 -0
- data/lib/.rbnext/3.0/yesql/query/result.rb +41 -0
- data/lib/.rbnext/3.0/yesql/query/transform_result.rb +48 -0
- data/lib/.rbnext/3.0/yesql/statement.rb +44 -0
- data/lib/.rbnext/3.0/yesql/utils/read.rb +20 -0
- data/lib/yesql.rb +26 -31
- data/lib/yesql/bindings/extract.rb +15 -20
- data/lib/yesql/bindings/extractor.rb +21 -21
- data/lib/yesql/bindings/transformed.rb +58 -0
- data/lib/yesql/bindings/utils.rb +7 -5
- data/lib/yesql/common/adapter.rb +6 -13
- data/lib/yesql/config/configuration.rb +4 -5
- data/lib/yesql/errors/file_path_does_not_exist_error.rb +22 -17
- data/lib/yesql/errors/no_bindings_provided_error.rb +20 -19
- data/lib/yesql/errors/output_argument_error.rb +13 -4
- data/lib/yesql/params/output.rb +26 -0
- data/lib/yesql/query/performer.rb +20 -64
- data/lib/yesql/query/result.rb +41 -0
- data/lib/yesql/query/transform_result.rb +48 -0
- data/lib/yesql/statement.rb +44 -0
- data/lib/yesql/utils/read.rb +11 -8
- data/lib/yesql/version.rb +1 -1
- metadata +67 -18
- data/.gitignore +0 -1
- data/Gemfile +0 -9
- data/Gemfile.lock +0 -167
- data/Rakefile +0 -1
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/yesql/bindings/binder.rb +0 -19
- data/lib/yesql/errors/cache_expiration_error.rb +0 -18
- data/yesql.gemspec +0 -28
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_record"
|
4
|
+
|
5
|
+
require "forwardable"
|
6
|
+
|
7
|
+
require "yesql/utils/read"
|
8
|
+
require "yesql/bindings/extractor"
|
9
|
+
require "yesql/common/adapter"
|
10
|
+
|
11
|
+
module ::YeSQL
|
12
|
+
class Statement
|
13
|
+
extend ::Forwardable
|
14
|
+
|
15
|
+
include ::YeSQL::Common::Adapter
|
16
|
+
include ::YeSQL::Utils::Read
|
17
|
+
# Give access to the quote method.
|
18
|
+
include ::ActiveRecord::ConnectionAdapters::Quoting
|
19
|
+
|
20
|
+
def initialize(bindings = {}, file_path)
|
21
|
+
@bindings = bindings
|
22
|
+
@file_path = file_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def bound
|
26
|
+
to_s.gsub(::YeSQL::BIND_REGEX) { extract_bind_values(extractor[_1[/(\w+)/].to_sym]) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_s = @to_s ||= statement(readable: true)
|
30
|
+
def view? = to_s =~ /^create\s.*view\s/i
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
attr_reader :bindings, :file_path
|
35
|
+
|
36
|
+
def extract_bind_values(match)
|
37
|
+
return quote(match[:value]) if view?
|
38
|
+
|
39
|
+
match[:bind][:vars]
|
40
|
+
end
|
41
|
+
|
42
|
+
def extractor = @extractor ||= ::YeSQL::Bindings::Extractor.new(bindings: bindings).call
|
43
|
+
end
|
44
|
+
end
|
data/lib/yesql/utils/read.rb
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module YeSQL
|
3
|
+
module ::YeSQL
|
4
4
|
module Utils
|
5
5
|
module Read
|
6
|
-
def
|
7
|
-
Dir["./#{::YeSQL.config.path}/**/*.sql"]
|
8
|
-
.find { |dir_file_path| dir_file_path.include?("#{file_path}.sql") }
|
9
|
-
.tap do |sql_file_path|
|
10
|
-
break File.readlines(sql_file_path, chomp: true).join(' ') if readable == true
|
6
|
+
def statement(readable: false) = read_file(found_file, readable)
|
11
7
|
|
12
|
-
|
13
|
-
|
8
|
+
private
|
9
|
+
|
10
|
+
def read_file(file, readable)
|
11
|
+
return File.readlines(file, chomp: true).join(" ") if readable == true
|
12
|
+
|
13
|
+
File.read(file)
|
14
14
|
end
|
15
|
+
|
16
|
+
def found_file = dir_sql_files.find { _1.include?("#{file_path}.sql") }
|
17
|
+
def dir_sql_files = Dir["./#{::YeSQL.config.path}/**/*.sql"]
|
15
18
|
end
|
16
19
|
end
|
17
20
|
end
|
data/lib/yesql/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yesql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastián Palma
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.0.beta1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.0.0.beta1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ruby-next-core
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.12.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.12.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: backports
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.21.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.21.0
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: mysql2
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,29 +115,50 @@ executables: []
|
|
87
115
|
extensions: []
|
88
116
|
extra_rdoc_files: []
|
89
117
|
files:
|
90
|
-
- ".gitignore"
|
91
|
-
- Gemfile
|
92
|
-
- Gemfile.lock
|
93
118
|
- LICENSE.txt
|
94
119
|
- README.md
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
120
|
+
- lib/.rbnext/2.3/yesql/errors/file_path_does_not_exist_error.rb
|
121
|
+
- lib/.rbnext/2.3/yesql/errors/no_bindings_provided_error.rb
|
122
|
+
- lib/.rbnext/2.3/yesql/errors/output_argument_error.rb
|
123
|
+
- lib/.rbnext/2.3/yesql/query/transform_result.rb
|
124
|
+
- lib/.rbnext/2.7/yesql/bindings/extract.rb
|
125
|
+
- lib/.rbnext/2.7/yesql/bindings/extractor.rb
|
126
|
+
- lib/.rbnext/2.7/yesql/bindings/transformed.rb
|
127
|
+
- lib/.rbnext/2.7/yesql/bindings/utils.rb
|
128
|
+
- lib/.rbnext/2.7/yesql/errors/file_path_does_not_exist_error.rb
|
129
|
+
- lib/.rbnext/2.7/yesql/errors/no_bindings_provided_error.rb
|
130
|
+
- lib/.rbnext/2.7/yesql/query/transform_result.rb
|
131
|
+
- lib/.rbnext/2.7/yesql/statement.rb
|
132
|
+
- lib/.rbnext/2.7/yesql/utils/read.rb
|
133
|
+
- lib/.rbnext/3.0/yesql/bindings/extract.rb
|
134
|
+
- lib/.rbnext/3.0/yesql/bindings/transformed.rb
|
135
|
+
- lib/.rbnext/3.0/yesql/common/adapter.rb
|
136
|
+
- lib/.rbnext/3.0/yesql/config/configuration.rb
|
137
|
+
- lib/.rbnext/3.0/yesql/errors/file_path_does_not_exist_error.rb
|
138
|
+
- lib/.rbnext/3.0/yesql/errors/no_bindings_provided_error.rb
|
139
|
+
- lib/.rbnext/3.0/yesql/params/output.rb
|
140
|
+
- lib/.rbnext/3.0/yesql/query/performer.rb
|
141
|
+
- lib/.rbnext/3.0/yesql/query/result.rb
|
142
|
+
- lib/.rbnext/3.0/yesql/query/transform_result.rb
|
143
|
+
- lib/.rbnext/3.0/yesql/statement.rb
|
144
|
+
- lib/.rbnext/3.0/yesql/utils/read.rb
|
98
145
|
- lib/yesql.rb
|
99
|
-
- lib/yesql/bindings/binder.rb
|
100
146
|
- lib/yesql/bindings/extract.rb
|
101
147
|
- lib/yesql/bindings/extractor.rb
|
148
|
+
- lib/yesql/bindings/transformed.rb
|
102
149
|
- lib/yesql/bindings/utils.rb
|
103
150
|
- lib/yesql/common/adapter.rb
|
104
151
|
- lib/yesql/config/configuration.rb
|
105
|
-
- lib/yesql/errors/cache_expiration_error.rb
|
106
152
|
- lib/yesql/errors/file_path_does_not_exist_error.rb
|
107
153
|
- lib/yesql/errors/no_bindings_provided_error.rb
|
108
154
|
- lib/yesql/errors/output_argument_error.rb
|
155
|
+
- lib/yesql/params/output.rb
|
109
156
|
- lib/yesql/query/performer.rb
|
157
|
+
- lib/yesql/query/result.rb
|
158
|
+
- lib/yesql/query/transform_result.rb
|
159
|
+
- lib/yesql/statement.rb
|
110
160
|
- lib/yesql/utils/read.rb
|
111
161
|
- lib/yesql/version.rb
|
112
|
-
- yesql.gemspec
|
113
162
|
homepage: https://github.com/sebastian-palma/yesql
|
114
163
|
licenses:
|
115
164
|
- MIT
|
@@ -117,7 +166,7 @@ metadata:
|
|
117
166
|
homepage_uri: https://github.com/sebastian-palma/yesql
|
118
167
|
source_code_uri: https://github.com/sebastian-palma/yesql
|
119
168
|
changelog_uri: https://github.com/sebastian-palma/yesql
|
120
|
-
post_install_message:
|
169
|
+
post_install_message:
|
121
170
|
rdoc_options: []
|
122
171
|
require_paths:
|
123
172
|
- lib
|
@@ -132,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
181
|
- !ruby/object:Gem::Version
|
133
182
|
version: '0'
|
134
183
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
136
|
-
signing_key:
|
184
|
+
rubygems_version: 3.2.3
|
185
|
+
signing_key:
|
137
186
|
specification_version: 4
|
138
187
|
summary: Ruby library to use SQL
|
139
188
|
test_files: []
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
spec/minimalpg/log/test.log
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
yesql (0.1.4)
|
5
|
-
rails (>= 5.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
actioncable (6.0.3.4)
|
11
|
-
actionpack (= 6.0.3.4)
|
12
|
-
nio4r (~> 2.0)
|
13
|
-
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailbox (6.0.3.4)
|
15
|
-
actionpack (= 6.0.3.4)
|
16
|
-
activejob (= 6.0.3.4)
|
17
|
-
activerecord (= 6.0.3.4)
|
18
|
-
activestorage (= 6.0.3.4)
|
19
|
-
activesupport (= 6.0.3.4)
|
20
|
-
mail (>= 2.7.1)
|
21
|
-
actionmailer (6.0.3.4)
|
22
|
-
actionpack (= 6.0.3.4)
|
23
|
-
actionview (= 6.0.3.4)
|
24
|
-
activejob (= 6.0.3.4)
|
25
|
-
mail (~> 2.5, >= 2.5.4)
|
26
|
-
rails-dom-testing (~> 2.0)
|
27
|
-
actionpack (6.0.3.4)
|
28
|
-
actionview (= 6.0.3.4)
|
29
|
-
activesupport (= 6.0.3.4)
|
30
|
-
rack (~> 2.0, >= 2.0.8)
|
31
|
-
rack-test (>= 0.6.3)
|
32
|
-
rails-dom-testing (~> 2.0)
|
33
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
34
|
-
actiontext (6.0.3.4)
|
35
|
-
actionpack (= 6.0.3.4)
|
36
|
-
activerecord (= 6.0.3.4)
|
37
|
-
activestorage (= 6.0.3.4)
|
38
|
-
activesupport (= 6.0.3.4)
|
39
|
-
nokogiri (>= 1.8.5)
|
40
|
-
actionview (6.0.3.4)
|
41
|
-
activesupport (= 6.0.3.4)
|
42
|
-
builder (~> 3.1)
|
43
|
-
erubi (~> 1.4)
|
44
|
-
rails-dom-testing (~> 2.0)
|
45
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
46
|
-
activejob (6.0.3.4)
|
47
|
-
activesupport (= 6.0.3.4)
|
48
|
-
globalid (>= 0.3.6)
|
49
|
-
activemodel (6.0.3.4)
|
50
|
-
activesupport (= 6.0.3.4)
|
51
|
-
activerecord (6.0.3.4)
|
52
|
-
activemodel (= 6.0.3.4)
|
53
|
-
activesupport (= 6.0.3.4)
|
54
|
-
activestorage (6.0.3.4)
|
55
|
-
actionpack (= 6.0.3.4)
|
56
|
-
activejob (= 6.0.3.4)
|
57
|
-
activerecord (= 6.0.3.4)
|
58
|
-
marcel (~> 0.3.1)
|
59
|
-
activesupport (6.0.3.4)
|
60
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
61
|
-
i18n (>= 0.7, < 2)
|
62
|
-
minitest (~> 5.1)
|
63
|
-
tzinfo (~> 1.1)
|
64
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
65
|
-
builder (3.2.4)
|
66
|
-
coderay (1.1.3)
|
67
|
-
concurrent-ruby (1.1.7)
|
68
|
-
crass (1.0.6)
|
69
|
-
diff-lcs (1.4.4)
|
70
|
-
erubi (1.9.0)
|
71
|
-
globalid (0.4.2)
|
72
|
-
activesupport (>= 4.2.0)
|
73
|
-
i18n (1.8.5)
|
74
|
-
concurrent-ruby (~> 1.0)
|
75
|
-
loofah (2.7.0)
|
76
|
-
crass (~> 1.0.2)
|
77
|
-
nokogiri (>= 1.5.9)
|
78
|
-
mail (2.7.1)
|
79
|
-
mini_mime (>= 0.1.1)
|
80
|
-
marcel (0.3.3)
|
81
|
-
mimemagic (~> 0.3.2)
|
82
|
-
method_source (1.0.0)
|
83
|
-
mimemagic (0.3.5)
|
84
|
-
mini_mime (1.0.2)
|
85
|
-
mini_portile2 (2.4.0)
|
86
|
-
minitest (5.14.2)
|
87
|
-
mysql2 (0.5.3)
|
88
|
-
nio4r (2.5.4)
|
89
|
-
nokogiri (1.10.10)
|
90
|
-
mini_portile2 (~> 2.4.0)
|
91
|
-
pg (1.2.3)
|
92
|
-
pry (0.13.1)
|
93
|
-
coderay (~> 1.1)
|
94
|
-
method_source (~> 1.0)
|
95
|
-
rack (2.2.3)
|
96
|
-
rack-test (1.1.0)
|
97
|
-
rack (>= 1.0, < 3)
|
98
|
-
rails (6.0.3.4)
|
99
|
-
actioncable (= 6.0.3.4)
|
100
|
-
actionmailbox (= 6.0.3.4)
|
101
|
-
actionmailer (= 6.0.3.4)
|
102
|
-
actionpack (= 6.0.3.4)
|
103
|
-
actiontext (= 6.0.3.4)
|
104
|
-
actionview (= 6.0.3.4)
|
105
|
-
activejob (= 6.0.3.4)
|
106
|
-
activemodel (= 6.0.3.4)
|
107
|
-
activerecord (= 6.0.3.4)
|
108
|
-
activestorage (= 6.0.3.4)
|
109
|
-
activesupport (= 6.0.3.4)
|
110
|
-
bundler (>= 1.3.0)
|
111
|
-
railties (= 6.0.3.4)
|
112
|
-
sprockets-rails (>= 2.0.0)
|
113
|
-
rails-dom-testing (2.0.3)
|
114
|
-
activesupport (>= 4.2.0)
|
115
|
-
nokogiri (>= 1.6)
|
116
|
-
rails-html-sanitizer (1.3.0)
|
117
|
-
loofah (~> 2.3)
|
118
|
-
railties (6.0.3.4)
|
119
|
-
actionpack (= 6.0.3.4)
|
120
|
-
activesupport (= 6.0.3.4)
|
121
|
-
method_source
|
122
|
-
rake (>= 0.8.7)
|
123
|
-
thor (>= 0.20.3, < 2.0)
|
124
|
-
rake (13.0.1)
|
125
|
-
rspec (3.9.0)
|
126
|
-
rspec-core (~> 3.9.0)
|
127
|
-
rspec-expectations (~> 3.9.0)
|
128
|
-
rspec-mocks (~> 3.9.0)
|
129
|
-
rspec-core (3.9.2)
|
130
|
-
rspec-support (~> 3.9.3)
|
131
|
-
rspec-expectations (3.9.2)
|
132
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
133
|
-
rspec-support (~> 3.9.0)
|
134
|
-
rspec-mocks (3.9.1)
|
135
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
136
|
-
rspec-support (~> 3.9.0)
|
137
|
-
rspec-support (3.9.3)
|
138
|
-
sprockets (4.0.2)
|
139
|
-
concurrent-ruby (~> 1.0)
|
140
|
-
rack (> 1, < 3)
|
141
|
-
sprockets-rails (3.2.2)
|
142
|
-
actionpack (>= 4.0)
|
143
|
-
activesupport (>= 4.0)
|
144
|
-
sprockets (>= 3.0.0)
|
145
|
-
thor (1.0.1)
|
146
|
-
thread_safe (0.3.6)
|
147
|
-
tzinfo (1.2.7)
|
148
|
-
thread_safe (~> 0.1)
|
149
|
-
websocket-driver (0.7.3)
|
150
|
-
websocket-extensions (>= 0.1.0)
|
151
|
-
websocket-extensions (0.1.5)
|
152
|
-
yard (0.9.25)
|
153
|
-
zeitwerk (2.4.0)
|
154
|
-
|
155
|
-
PLATFORMS
|
156
|
-
ruby
|
157
|
-
|
158
|
-
DEPENDENCIES
|
159
|
-
mysql2 (~> 0.5.3)
|
160
|
-
pg (>= 0.18)
|
161
|
-
pry (~> 0.13.1)
|
162
|
-
rspec (~> 3.9.0)
|
163
|
-
yard
|
164
|
-
yesql!
|
165
|
-
|
166
|
-
BUNDLED WITH
|
167
|
-
2.1.4
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "yesql"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'yesql/utils/read'
|
4
|
-
require 'yesql/bindings/extractor'
|
5
|
-
|
6
|
-
module YeSQL
|
7
|
-
module Bindings
|
8
|
-
class Binder
|
9
|
-
def self.bind_statement(file_path, bindings)
|
10
|
-
::YeSQL::Bindings::Extractor.new(bindings: bindings).call.tap do |extractor|
|
11
|
-
break ::YeSQL::Utils::Read.statement(file_path, readable: true)
|
12
|
-
.gsub(::YeSQL::BIND_REGEX) do |match|
|
13
|
-
extractor[match[/(\w+)/].to_sym][:bind][:vars]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|