query_optimizer 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d39bb02dc7d380c9fa32d98e39a0feda065ae7f
4
- data.tar.gz: 275ebf3273e53b7ea9a78b21ae8326d65393c6bb
3
+ metadata.gz: 2d2b176485f31c12e5917dc6f1f1c22b26dbf72c
4
+ data.tar.gz: d425922bc775bc57e08e0e9eea682b76e1c37081
5
5
  SHA512:
6
- metadata.gz: d41155b5ea2e718eafdc725ed953816052356376f7cf1fbabcd4ccf2df2759b1ff1fd110289f8356c4880f3cf66c087c6e4b92e54f7d52d6d6205380d66b0135
7
- data.tar.gz: f865c563f6050da8534d828959827c738c3b81803ce20f57483ef14bc9fe0020b7b246cf9c0fcb710314b9288ea9b5bb4e4e7f4b0ae7aba6772aeb9e6f8f54f4
6
+ metadata.gz: 9a16d8277643f429c342e42b325e347879a59a9435f0a2096d027d92f1ce123327e0149e9440293bbddc44552e104df9924c2976a3f6a5099138f4bf66453ffd
7
+ data.tar.gz: 423a12edc6fdbaeb5d4430767fdd7497abc0d0ff72f153c0c6db98267b92d2a18c49f435286321ca5b289d144c5be8ede7b0ea05c10dcb3f9175e701f330b608
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in query_optimizer.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Akshay
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,5 +1,31 @@
1
- # query_optimizer
2
- This is rails gem which will minimize query for many_to_many relationship .
3
- Minimize query by query_optimizer just pass your model name as QueryOptimizer.optimize_query(Model1,Model2)
1
+ # QueryOptimizer
4
2
 
5
- Refer https://github.com/akshaygoyal88/query_optimizer/blob/master/README.rdoc for usage
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'query_optimizer'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install query_optimizer
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/query_optimizer/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile CHANGED
@@ -1,14 +1,2 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'echoe'
1
+ require "bundler/gem_tasks"
4
2
 
5
- Echoe.new('query_optimizer', '0.1.1') do |p|
6
- p.description = "Minimize query for fetching table row"
7
- p.url = "http://github.com/akshaygoyal88/query_optimizer"
8
- p.author = "Akshay Goyal"
9
- p.email = "akshay.goyal1008@gmail.com"
10
- p.ignore_pattern = ["tmp/*", "script/*"]
11
- p.development_dependencies = []
12
- end
13
-
14
- Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
@@ -0,0 +1,3 @@
1
+ module QueryOptimizer
2
+ VERSION = "0.1.2"
3
+ end
@@ -2,7 +2,8 @@ module QueryOptimizer
2
2
  def self.optimize_query(model1,model2)
3
3
  table1 = model1.table_name
4
4
  table2 = model2.table_name
5
- results = ActiveRecord::Base.connection.execute("SELECT #{table1}.*,#{table2}.* FROM #{table1} INNER JOIN #{table2} on #{table1}.id=#{table2}.post_id")
5
+ get_singular_name = table1.singularize
6
+ results = ActiveRecord::Base.connection.execute("SELECT #{table1}.*,#{table2}.* FROM #{table1} INNER JOIN #{table2} on #{table1}.id=#{table2}.#{get_singular_name}_id")
6
7
  table1_columns = model1.column_names
7
8
  table2_columns = model2.column_names
8
9
  table1_columns = table1_columns.map { |word| "#{table1}_#{word}" }
@@ -1,21 +1,23 @@
1
- # -*- encoding: utf-8 -*-
2
- # stub: query_optimizer 0.1.1 ruby lib
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'query_optimizer/version'
3
5
 
4
- Gem::Specification.new do |s|
5
- s.name = "query_optimizer"
6
- s.version = "0.1.1"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "query_optimizer"
8
+ spec.version = QueryOptimizer::VERSION
9
+ spec.authors = ["Akshay"]
10
+ spec.email = ["akshay.goyal1008@gmail.com"]
11
+ spec.summary = %q{This is rails gem which will minimize query for many_to_many relationship}
12
+ spec.description = %q{This is rails gem which will minimize query for many_to_many relationship.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
7
15
 
8
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
9
- s.require_paths = ["lib"]
10
- s.authors = ["Akshay Goyal"]
11
- s.date = "2015-10-18"
12
- s.description = "Minimize query for fetching table row"
13
- s.email = "akshay.goyal1008@gmail.com"
14
- s.extra_rdoc_files = ["LICENSE", "README.md", "README.rdoc", "lib/query_optimizer.rb"]
15
- s.files = ["LICENSE", "Manifest", "README.md", "README.rdoc", "Rakefile", "lib/query_optimizer.rb", "query_optimizer.gemspec"]
16
- s.homepage = "http://github.com/akshaygoyal88/query_optimizer"
17
- s.rdoc_options = ["--line-numbers", "--title", "Query_optimizer", "--main", "README.md"]
18
- s.rubyforge_project = "query_optimizer"
19
- s.rubygems_version = "2.2.2"
20
- s.summary = "Minimize query for fetching table row"
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
21
23
  end
metadata CHANGED
@@ -1,42 +1,67 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_optimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
- - Akshay Goyal
7
+ - Akshay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-10-18 00:00:00.000000000 Z
12
- dependencies: []
13
- description: Minimize query for fetching table row
14
- email: akshay.goyal1008@gmail.com
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: This is rails gem which will minimize query for many_to_many relationship.
42
+ email:
43
+ - akshay.goyal1008@gmail.com
15
44
  executables: []
16
45
  extensions: []
17
- extra_rdoc_files:
18
- - LICENSE
19
- - README.md
20
- - README.rdoc
21
- - lib/query_optimizer.rb
46
+ extra_rdoc_files: []
22
47
  files:
48
+ - ".gitignore"
49
+ - Gemfile
23
50
  - LICENSE
51
+ - LICENSE.txt
24
52
  - Manifest
25
53
  - README.md
26
54
  - README.rdoc
27
55
  - Rakefile
28
56
  - lib/query_optimizer.rb
57
+ - lib/query_optimizer/version.rb
29
58
  - query_optimizer.gemspec
30
- homepage: http://github.com/akshaygoyal88/query_optimizer
31
- licenses: []
59
+ homepage: ''
60
+ licenses:
61
+ - MIT
32
62
  metadata: {}
33
63
  post_install_message:
34
- rdoc_options:
35
- - "--line-numbers"
36
- - "--title"
37
- - Query_optimizer
38
- - "--main"
39
- - README.md
64
+ rdoc_options: []
40
65
  require_paths:
41
66
  - lib
42
67
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -48,11 +73,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
73
  requirements:
49
74
  - - ">="
50
75
  - !ruby/object:Gem::Version
51
- version: '1.2'
76
+ version: '0'
52
77
  requirements: []
53
- rubyforge_project: query_optimizer
78
+ rubyforge_project:
54
79
  rubygems_version: 2.2.2
55
80
  signing_key:
56
81
  specification_version: 4
57
- summary: Minimize query for fetching table row
82
+ summary: This is rails gem which will minimize query for many_to_many relationship
58
83
  test_files: []