google-cloud-firestore 2.9.0 → 2.9.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31a027bd1f01c1bd2568417742a77525e4e5659316a9e81ff123062d095b580c
|
4
|
+
data.tar.gz: d85d3a069d0f3f3847a10ea0963896c3be546f8452a1eb8eb06e9d7c664ec525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6d1ebeb7079ce28256ab3348110fdbab52d73db16e0cf6d7a1ee27f343d9918d1b8a3e7225504c268a13d3e7371706028487e2a14fcbf0e2b7e2cf8dcbda371
|
7
|
+
data.tar.gz: 7c34ced999d1368fdc3e645e128197fc7e9cb51850bf39cb753b680bbd5d6a1f70ba3572be04d5ab4c909008104c8a5cd4f1144d24e630ebbebb8333fef6baf1
|
data/CHANGELOG.md
CHANGED
@@ -38,7 +38,7 @@ module Google
|
|
38
38
|
# .add_count
|
39
39
|
#
|
40
40
|
# aggregate_query.get do |aggregate_snapshot|
|
41
|
-
# puts aggregate_snapshot.get
|
41
|
+
# puts aggregate_snapshot.get
|
42
42
|
# end
|
43
43
|
#
|
44
44
|
# @example Alias an aggregate query
|
@@ -102,7 +102,7 @@ module Google
|
|
102
102
|
# .add_count
|
103
103
|
#
|
104
104
|
# aggregate_query.get do |aggregate_snapshot|
|
105
|
-
# puts aggregate_snapshot.get
|
105
|
+
# puts aggregate_snapshot.get
|
106
106
|
# end
|
107
107
|
#
|
108
108
|
def add_count aggregate_alias: nil
|
@@ -135,7 +135,7 @@ module Google
|
|
135
135
|
# .add_count
|
136
136
|
#
|
137
137
|
# aggregate_query.get do |aggregate_snapshot|
|
138
|
-
# puts aggregate_snapshot.get
|
138
|
+
# puts aggregate_snapshot.get
|
139
139
|
# end
|
140
140
|
#
|
141
141
|
def get
|
@@ -34,16 +34,31 @@ module Google
|
|
34
34
|
# .add_count
|
35
35
|
#
|
36
36
|
# aggregate_query.get do |aggregate_snapshot|
|
37
|
-
# puts aggregate_snapshot.get
|
37
|
+
# puts aggregate_snapshot.get
|
38
38
|
# end
|
39
|
+
# @return [Integer] The aggregate value.
|
39
40
|
#
|
41
|
+
# @example Alias an aggregate query
|
42
|
+
# require "google/cloud/firestore"
|
43
|
+
#
|
44
|
+
# firestore = Google::Cloud::Firestore.new
|
45
|
+
#
|
46
|
+
# query = firestore.col "cities"
|
47
|
+
#
|
48
|
+
# # Create an aggregate query
|
49
|
+
# aggregate_query = query.aggregate_query
|
50
|
+
# .add_count aggregate_alias: 'total'
|
51
|
+
#
|
52
|
+
# aggregate_query.get do |aggregate_snapshot|
|
53
|
+
# puts aggregate_snapshot.get('total')
|
54
|
+
# end
|
40
55
|
class AggregateQuerySnapshot
|
41
56
|
##
|
42
57
|
# Retrieves the aggregate data.
|
43
58
|
#
|
44
|
-
# @param [String]
|
45
|
-
#
|
46
|
-
#
|
59
|
+
# @param aggregate_alias [String] The alias used to access
|
60
|
+
# the aggregate value. For an AggregateQuery with a
|
61
|
+
# single aggregate field, this parameter can be omitted.
|
47
62
|
#
|
48
63
|
# @return [Integer] The aggregate value.
|
49
64
|
#
|
@@ -59,9 +74,29 @@ module Google
|
|
59
74
|
# .add_count
|
60
75
|
#
|
61
76
|
# aggregate_query.get do |aggregate_snapshot|
|
62
|
-
# puts aggregate_snapshot.get
|
77
|
+
# puts aggregate_snapshot.get
|
63
78
|
# end
|
64
|
-
|
79
|
+
# @return [Integer] The aggregate value.
|
80
|
+
#
|
81
|
+
# @example Alias an aggregate query
|
82
|
+
# require "google/cloud/firestore"
|
83
|
+
#
|
84
|
+
# firestore = Google::Cloud::Firestore.new
|
85
|
+
#
|
86
|
+
# query = firestore.col "cities"
|
87
|
+
#
|
88
|
+
# # Create an aggregate query
|
89
|
+
# aggregate_query = query.aggregate_query
|
90
|
+
# .add_count aggregate_alias: 'total'
|
91
|
+
#
|
92
|
+
# aggregate_query.get do |aggregate_snapshot|
|
93
|
+
# puts aggregate_snapshot.get('total')
|
94
|
+
# end
|
95
|
+
def get aggregate_alias = nil
|
96
|
+
if @aggregate_fields.count > 1 && aggregate_alias.nil?
|
97
|
+
raise ArgumentError, "Required param aggregate_alias for AggregateQuery with multiple aggregate fields"
|
98
|
+
end
|
99
|
+
aggregate_alias ||= @aggregate_fields.keys.first
|
65
100
|
@aggregate_fields[aggregate_alias]
|
66
101
|
end
|
67
102
|
|
@@ -286,9 +286,15 @@ module Google
|
|
286
286
|
#
|
287
287
|
# firestore = Google::Cloud::Firestore.new
|
288
288
|
#
|
289
|
+
# query = firestore.col "cities"
|
290
|
+
#
|
291
|
+
# # Create an aggregate query
|
292
|
+
# aq = query.aggregate_query
|
293
|
+
# .add_count
|
294
|
+
#
|
289
295
|
# firestore.transaction do |tx|
|
290
296
|
# tx.get_aggregate aq do |aggregate_snapshot|
|
291
|
-
# puts aggregate_snapshot.get
|
297
|
+
# puts aggregate_snapshot.get
|
292
298
|
# end
|
293
299
|
# end
|
294
300
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-firestore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|