lockstep_rails 0.3.55 → 0.3.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/app/concepts/lockstep/query.rb +13 -2
- data/lib/lockstep_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63461b12ae57b46134cdc4ccccc5f75c09d784a548cbc1af3d2ead246f435180
|
4
|
+
data.tar.gz: 072e87d56d6896a6833e7bcc0f70d6d2760633a73a4a5bb9278c1e12cd174739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d2ebc46296806ae30db4cf047882f0b0c6f61b544d8b9efc74b212e7f06774a08bf97c61e463c4cb3b5b50642275a354aae2485c0ecd5879177cd27cf1057b7
|
7
|
+
data.tar.gz: a5de08cf74884672c7f23175fe0a43b428ec47939b008080f9337dd2f1636c3cace321b845fef5021d12e6671fd5fad9887c750193e1f4a80ded4b321d3932f7
|
data/README.md
CHANGED
@@ -175,7 +175,11 @@ Lockstep::Connection.count
|
|
175
175
|
Lockstep::Connection.where(status: "Active").count
|
176
176
|
# 100
|
177
177
|
```
|
178
|
-
|
178
|
+
### With Count
|
179
|
+
```ruby
|
180
|
+
records , count = Lockstep::Connection.where(status: "active").with_count(true).execute
|
181
|
+
# records get the records for the query and the with count if used will return the total number of records present for that query.
|
182
|
+
```
|
179
183
|
### Limit
|
180
184
|
You can limit the number of records being fetched by passing `limit`
|
181
185
|
|
@@ -92,6 +92,12 @@ class Lockstep::Query
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
def with_count(value)
|
96
|
+
with_clone do
|
97
|
+
criteria[:with_count] = value
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
95
101
|
# attr: {customer_name: :desc}
|
96
102
|
def order(*attr)
|
97
103
|
with_clone do
|
@@ -242,13 +248,18 @@ class Lockstep::Query
|
|
242
248
|
else
|
243
249
|
results = parsed_response.is_a?(Array) ? parsed_response : parsed_response["records"]
|
244
250
|
return [] if results.blank?
|
245
|
-
|
246
251
|
results = results[0..(criteria[:limit] - 1)] if criteria[:limit]
|
247
|
-
get_relation_objects results.map { |r|
|
252
|
+
records = get_relation_objects results.map { |r|
|
248
253
|
# Convert camelcase to snake-case
|
249
254
|
r = r.transform_keys { |key| key.underscore }
|
250
255
|
@klass.model_name.to_s.constantize.new(r, false)
|
251
256
|
}
|
257
|
+
|
258
|
+
if criteria[:with_count]
|
259
|
+
[records, parsed_response["totalCount"]]
|
260
|
+
else
|
261
|
+
records
|
262
|
+
end
|
252
263
|
end
|
253
264
|
end
|
254
265
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lockstep_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.57
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vivek AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|