flounder 0.18.0 → 0.18.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 212f1134237b0adfe5f4f94d8f79d508a2997ce9
4
- data.tar.gz: e093b402cf0cf81c9b01c178ac6b20847d4b9403
3
+ metadata.gz: 370d0a1cfd677a805e751dc4532e59b910b06eea
4
+ data.tar.gz: 49c396164c6dcab26cd99fc5422e9da446875312
5
5
  SHA512:
6
- metadata.gz: 8444a433354c815819d087c8c44d85bb56b3389d452d6f5ab554927e22a056763eda19383be7bd94cc4cf5c9d87b8452a61de254de30283acda9b33a881a60e7
7
- data.tar.gz: 334f3c8a41c8b26ba4cf86f6ec8e36813106c4015daa2110d84a190d82854612097cb0dcbbefdf199114e72f5930d71c1798f4ae97aa86b5c221eaf317049e6a
6
+ metadata.gz: 10b2cc277db56cd71d20e19c1ab1cbd6d69408a9710e1ba48c48f33be90dba2be6bcbd55045babf05a29a6916718f82f86aca471cdfd285281897bbfc8aa9c16
7
+ data.tar.gz: e691b31f51aa335a3f868650b166d6758e72706e5baea29674002897090b26522da0aac40fa5678d5f6320108dfb5a1baaf4b300faa578a0ef9d63b5e98b53f5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flounder (0.17.0)
4
+ flounder (0.18.0)
5
5
  aggregate (~> 0.2, >= 0.2.2)
6
6
  arel (~> 5, > 5.0.1)
7
7
  connection_pool (~> 2)
data/flounder.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "flounder"
5
- s.version = '0.18.0'
5
+ s.version = '0.18.1'
6
6
  s.summary = "Flounder is a way to write SQL simply in Ruby. It deals with everything BUT object relational mapping. "
7
7
  s.email = "kaspar.schiess@technologyastronauts.ch"
8
8
  s.homepage = "https://bitbucket.org/technologyastronauts/oss_flounder"
@@ -6,22 +6,6 @@ module Flounder::Query
6
6
  # A query obtained by calling any of the chain methods on an entity.
7
7
  #
8
8
  class Select < Base
9
- def initialize domain, from_entity
10
- super domain, Arel::SelectManager, from_entity
11
-
12
- @has_projection = false
13
-
14
- @projection_prefixes = Hash.new
15
- @default_projection = []
16
-
17
- # by default, joins are made to the entity that you start the query with
18
- @join_entity = entity
19
-
20
- add_fields_to_default from_entity
21
-
22
- manager.from from_entity.table
23
- end
24
-
25
9
  # Arel SqlManager that accumulates this query.
26
10
  attr_reader :manager
27
11
 
@@ -43,13 +27,29 @@ module Flounder::Query
43
27
  # maps relations that were included in this select to their entities.
44
28
  attr_reader :relation_entity_map
45
29
 
30
+ def initialize domain, from_entity
31
+ super domain, Arel::SelectManager, from_entity
32
+
33
+ @has_projection = false
34
+
35
+ @projection_prefixes = Hash.new
36
+ @default_projection = []
37
+
38
+ # by default, joins are made to the entity that you start the query with
39
+ @join_entity = entity
40
+
41
+ @relation_entity_map = {}
42
+
43
+ add_fields_to_default from_entity
44
+
45
+ manager.from from_entity.table
46
+ end
47
+
46
48
  def _join join_node, entity
47
49
  entity = convert_to_entity(entity)
48
50
 
49
51
  @last_join = entity
50
52
 
51
- @relation_entity_map = {}
52
-
53
53
  table = entity.table
54
54
  manager.join(table, join_node)
55
55
  add_fields_to_default(entity)
@@ -154,6 +154,11 @@ module Flounder::Query
154
154
 
155
155
  all.first
156
156
  end
157
+
158
+ # Executes a `select count(*)` query on the database and returns the result.
159
+ # If you want to avoid modifying your query (!) using this, dup it or
160
+ # execute it first and then call #size on the resulting array.
161
+ #
157
162
  def size
158
163
  manager.projections = []
159
164
  project 'count(*) as count'
@@ -161,13 +166,24 @@ module Flounder::Query
161
166
  all.first.count
162
167
  end
163
168
 
164
- # Follows relationships on the currently anchored entity. This is like
165
- # an explicit join, but allows to eliminate repetition.
169
+ # Follows relationships on the currently anchored entity. This is like an
170
+ # explicit join, but allows to eliminate repetition.
171
+ #
172
+ # Example:
173
+ # users.
174
+ # connect(:posts => {:comments => :author}).
175
+ # where(:author, id: 2)
176
+ #
177
+ # # roughly aequivalent to
178
+ # authors = users.as(:authors, :author)
179
+ # users.
180
+ # join(:posts).on(:id => :user_id).anchor.
181
+ # join(:comments).on(:id => :post_id).anchor.
182
+ # join(authors).on(:author_id => :id).
183
+ # where(authors, id: 2)
166
184
  #
167
185
  def connect *connect_spec
168
- connect_spec.each do |spec_part|
169
- follow_relation_spec(join_entity, spec_part)
170
- end
186
+ follow_relation_spec(join_entity, connect_spec)
171
187
 
172
188
  self
173
189
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flounder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaspar Schiess
@@ -15,108 +15,108 @@ dependencies:
15
15
  name: arel
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '5'
21
- - - '>'
21
+ - - ">"
22
22
  - !ruby/object:Gem::Version
23
23
  version: 5.0.1
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - ~>
28
+ - - "~>"
29
29
  - !ruby/object:Gem::Version
30
30
  version: '5'
31
- - - '>'
31
+ - - ">"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 5.0.1
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: pg
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.17'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.17'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: hashie
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3'
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '3.2'
58
58
  type: :runtime
59
59
  prerelease: false
60
60
  version_requirements: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - ~>
62
+ - - "~>"
63
63
  - !ruby/object:Gem::Version
64
64
  version: '3'
65
- - - '>='
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '3.2'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: connection_pool
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ~>
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '2'
75
75
  type: :runtime
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ~>
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '2'
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: pg-hstore
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ~>
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '1.2'
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: 1.2.0
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ~>
96
+ - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '1.2'
99
- - - '>='
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: 1.2.0
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: aggregate
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - ~>
106
+ - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0.2'
109
- - - '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: 0.2.2
112
112
  type: :runtime
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ~>
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0.2'
119
- - - '>='
119
+ - - ">="
120
120
  - !ruby/object:Gem::Version
121
121
  version: 0.2.2
122
122
  description: " Flounder is the missing piece between the database and your Ruby
@@ -127,11 +127,14 @@ executables: []
127
127
  extensions: []
128
128
  extra_rdoc_files: []
129
129
  files:
130
- - flounder.gemspec
131
130
  - Gemfile
132
131
  - Gemfile.lock
133
132
  - HACKING
134
133
  - HISTORY
134
+ - LICENSE
135
+ - README
136
+ - flounder.gemspec
137
+ - lib/flounder.rb
135
138
  - lib/flounder/connection.rb
136
139
  - lib/flounder/connection_pool.rb
137
140
  - lib/flounder/domain.rb
@@ -152,8 +155,6 @@ files:
152
155
  - lib/flounder/query/update.rb
153
156
  - lib/flounder/relation.rb
154
157
  - lib/flounder/symbol_extensions.rb
155
- - lib/flounder.rb
156
- - LICENSE
157
158
  - qed/applique/ae.rb
158
159
  - qed/applique/flounder.rb
159
160
  - qed/applique/setup_domain.rb
@@ -172,7 +173,6 @@ files:
172
173
  - qed/projection.md
173
174
  - qed/selects.md
174
175
  - qed/updates.md
175
- - README
176
176
  homepage: https://bitbucket.org/technologyastronauts/oss_flounder
177
177
  licenses:
178
178
  - MIT
@@ -183,17 +183,17 @@ require_paths:
183
183
  - lib
184
184
  required_ruby_version: !ruby/object:Gem::Requirement
185
185
  requirements:
186
- - - '>='
186
+ - - ">="
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0'
189
189
  required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  requirements:
191
- - - '>='
191
+ - - ">="
192
192
  - !ruby/object:Gem::Version
193
193
  version: '0'
194
194
  requirements: []
195
195
  rubyforge_project:
196
- rubygems_version: 2.0.14
196
+ rubygems_version: 2.2.2
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Flounder is a way to write SQL simply in Ruby. It deals with everything BUT
@@ -217,3 +217,4 @@ test_files:
217
217
  - qed/projection.md
218
218
  - qed/selects.md
219
219
  - qed/updates.md
220
+ has_rdoc: