google-cloud-firestore 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +1 -1
- data/lib/google/cloud/firestore/batch.rb +4 -4
- data/lib/google/cloud/firestore/convert.rb +141 -161
- data/lib/google/cloud/firestore/transaction.rb +4 -4
- data/lib/google/cloud/firestore/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: 3947e279213a82502325fd1f9245f72c9b5d3fa837907608f6bdd62bff31e69f
|
4
|
+
data.tar.gz: 849fc8dc2f763b24334d4accdc2ee4196059c429d273f3f661bf50d81a6d9774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d2a6c39cc4b321a2561b5ae50928eaec7a3acfafe5fec62a7383d5c3dc77c60ba96f81c2c027bcfe46be6f8ab02c0f76f93afd0dd5ab5bb7fdea9e141a33fe4
|
7
|
+
data.tar.gz: 70b462d91bd613ee0a5c333653dc096c28878d4bf28eacc6282c4edf57123985eeec8eee4d98af24aba334ea824e2e37d2add104aa8e32c26c7668c7dc62df4f
|
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -119,7 +119,7 @@ module Google
|
|
119
119
|
|
120
120
|
doc_path = coalesce_doc_path_argument doc
|
121
121
|
|
122
|
-
@writes << Convert.
|
122
|
+
@writes << Convert.write_for_create(doc_path, data)
|
123
123
|
|
124
124
|
nil
|
125
125
|
end
|
@@ -218,7 +218,7 @@ module Google
|
|
218
218
|
|
219
219
|
doc_path = coalesce_doc_path_argument doc
|
220
220
|
|
221
|
-
@writes << Convert.
|
221
|
+
@writes << Convert.write_for_set(doc_path, data, merge: merge)
|
222
222
|
|
223
223
|
nil
|
224
224
|
end
|
@@ -322,8 +322,8 @@ module Google
|
|
322
322
|
|
323
323
|
doc_path = coalesce_doc_path_argument doc
|
324
324
|
|
325
|
-
@writes << Convert.
|
326
|
-
|
325
|
+
@writes << Convert.write_for_update(doc_path, data,
|
326
|
+
update_time: update_time)
|
327
327
|
|
328
328
|
nil
|
329
329
|
end
|
@@ -24,7 +24,13 @@ module Google
|
|
24
24
|
##
|
25
25
|
# @private Helper module for converting Protobuf values.
|
26
26
|
module Convert
|
27
|
-
# rubocop:disable
|
27
|
+
# rubocop:disable Metrics/AbcSize
|
28
|
+
# rubocop:disable Metrics/BlockLength
|
29
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
30
|
+
# rubocop:disable Metrics/MethodLength
|
31
|
+
# rubocop:disable Metrics/ModuleLength
|
32
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
33
|
+
# rubocop:disable Style/CaseEquality
|
28
34
|
module ClassMethods
|
29
35
|
def time_to_timestamp time
|
30
36
|
return nil if time.nil?
|
@@ -32,9 +38,10 @@ module Google
|
|
32
38
|
# Force the object to be a Time object.
|
33
39
|
time = time.to_time
|
34
40
|
|
35
|
-
Google::Protobuf::Timestamp.new
|
41
|
+
Google::Protobuf::Timestamp.new(
|
36
42
|
seconds: time.to_i,
|
37
|
-
nanos:
|
43
|
+
nanos: time.nsec
|
44
|
+
)
|
38
45
|
end
|
39
46
|
|
40
47
|
def timestamp_to_time timestamp
|
@@ -100,9 +107,10 @@ module Google
|
|
100
107
|
elsif Google::Cloud::Firestore::DocumentReference === obj
|
101
108
|
Google::Cloud::Firestore::V1::Value.new reference_value: obj.path
|
102
109
|
elsif Array === obj
|
103
|
-
values = obj.map { |o| raw_to_value
|
104
|
-
Google::Cloud::Firestore::V1::Value.new(
|
105
|
-
Google::Cloud::Firestore::V1::ArrayValue.new(values: values)
|
110
|
+
values = obj.map { |o| raw_to_value o }
|
111
|
+
Google::Cloud::Firestore::V1::Value.new(
|
112
|
+
array_value: Google::Cloud::Firestore::V1::ArrayValue.new(values: values)
|
113
|
+
)
|
106
114
|
elsif Hash === obj
|
107
115
|
# keys have been changed to strings before the hash gets here
|
108
116
|
geo_pairs = hash_is_geo_point? obj
|
@@ -112,8 +120,9 @@ module Google
|
|
112
120
|
)
|
113
121
|
else
|
114
122
|
fields = hash_to_fields obj
|
115
|
-
Google::Cloud::Firestore::V1::Value.new(
|
116
|
-
Google::Cloud::Firestore::V1::MapValue.new(fields: fields)
|
123
|
+
Google::Cloud::Firestore::V1::Value.new(
|
124
|
+
map_value: Google::Cloud::Firestore::V1::MapValue.new(fields: fields)
|
125
|
+
)
|
117
126
|
end
|
118
127
|
elsif obj.respond_to?(:read) && obj.respond_to?(:rewind)
|
119
128
|
obj.rewind
|
@@ -129,9 +138,7 @@ module Google
|
|
129
138
|
return false unless hash.keys.count == 2
|
130
139
|
|
131
140
|
pairs = hash.map { |k, v| [String(k), v] }.sort
|
132
|
-
if pairs.map(&:first) == ["latitude", "longitude"]
|
133
|
-
pairs
|
134
|
-
end
|
141
|
+
pairs if pairs.map(&:first) == ["latitude", "longitude"]
|
135
142
|
end
|
136
143
|
|
137
144
|
def hash_to_geo_point hash, pairs = nil
|
@@ -140,47 +147,39 @@ module Google
|
|
140
147
|
raise ArgumentError, "value is not a geo point" unless pairs
|
141
148
|
|
142
149
|
Google::Type::LatLng.new(
|
143
|
-
latitude:
|
144
|
-
longitude: pairs.last.last
|
150
|
+
latitude: pairs.first.last,
|
151
|
+
longitude: pairs.last.last
|
145
152
|
)
|
146
153
|
end
|
147
154
|
|
148
|
-
def
|
149
|
-
|
150
|
-
|
151
|
-
if is_field_value_nested data, :delete
|
155
|
+
def write_for_create doc_path, data
|
156
|
+
if field_value_nested? data, :delete
|
152
157
|
raise ArgumentError, "DELETE not allowed on create"
|
153
158
|
end
|
154
159
|
raise ArgumentError, "data is required" unless data.is_a? Hash
|
155
160
|
|
156
161
|
data, field_paths_and_values = remove_field_value_from data
|
157
162
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
if field_paths_and_values.any?
|
170
|
-
transform_write = transform_write doc_path, field_paths_and_values
|
171
|
-
|
172
|
-
if data.empty?
|
173
|
-
transform_write.current_document = \
|
174
|
-
Google::Cloud::Firestore::V1::Precondition.new(exists: false)
|
175
|
-
end
|
176
|
-
|
177
|
-
writes << transform_write
|
178
|
-
end
|
163
|
+
doc = Google::Cloud::Firestore::V1::Document.new(
|
164
|
+
name: doc_path,
|
165
|
+
fields: hash_to_fields(data)
|
166
|
+
)
|
167
|
+
precondition = Google::Cloud::Firestore::V1::Precondition.new exists: false
|
168
|
+
Google::Cloud::Firestore::V1::Write.new(
|
169
|
+
update: doc,
|
170
|
+
current_document: precondition,
|
171
|
+
update_transforms: field_transforms(field_paths_and_values)
|
172
|
+
)
|
173
|
+
end
|
179
174
|
|
180
|
-
|
175
|
+
def field_transforms paths
|
176
|
+
return nil if paths.empty?
|
177
|
+
paths.map do |field_path, field_value|
|
178
|
+
to_field_transform field_path, field_value
|
179
|
+
end.to_a
|
181
180
|
end
|
182
181
|
|
183
|
-
def
|
182
|
+
def write_for_set doc_path, data, merge: nil
|
184
183
|
raise ArgumentError, "data is required" unless data.is_a? Hash
|
185
184
|
|
186
185
|
if merge
|
@@ -195,11 +194,9 @@ module Google
|
|
195
194
|
end
|
196
195
|
allow_empty = false
|
197
196
|
end
|
198
|
-
return
|
197
|
+
return write_for_set_merge doc_path, data, field_paths, allow_empty
|
199
198
|
end
|
200
199
|
|
201
|
-
writes = []
|
202
|
-
|
203
200
|
data, delete_paths = remove_field_value_from data, :delete
|
204
201
|
if delete_paths.any?
|
205
202
|
raise ArgumentError, "DELETE not allowed on set"
|
@@ -207,30 +204,25 @@ module Google
|
|
207
204
|
|
208
205
|
data, field_paths_and_values = remove_field_value_from data
|
209
206
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
207
|
+
doc = Google::Cloud::Firestore::V1::Document.new(
|
208
|
+
name: doc_path,
|
209
|
+
fields: hash_to_fields(data)
|
210
|
+
)
|
211
|
+
Google::Cloud::Firestore::V1::Write.new(
|
212
|
+
update: doc,
|
213
|
+
update_transforms: field_transforms(field_paths_and_values)
|
214
214
|
)
|
215
|
-
|
216
|
-
if field_paths_and_values.any?
|
217
|
-
writes << transform_write(doc_path, field_paths_and_values)
|
218
|
-
end
|
219
|
-
|
220
|
-
writes
|
221
215
|
end
|
222
216
|
|
223
|
-
def
|
217
|
+
def write_for_set_merge doc_path, data, field_paths, allow_empty
|
224
218
|
raise ArgumentError, "data is required" unless data.is_a? Hash
|
225
219
|
|
226
220
|
validate_field_paths! field_paths
|
227
221
|
|
228
|
-
writes = []
|
229
|
-
|
230
222
|
# Ensure provided field paths are valid.
|
231
223
|
all_valid = identify_leaf_nodes data
|
232
224
|
all_valid_check = field_paths.map do |verify_path|
|
233
|
-
if all_valid.include?
|
225
|
+
if all_valid.include? verify_path
|
234
226
|
true
|
235
227
|
else
|
236
228
|
found_in_all_valid = all_valid.select do |fp|
|
@@ -277,26 +269,21 @@ module Google
|
|
277
269
|
end
|
278
270
|
end
|
279
271
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
end
|
293
|
-
|
294
|
-
writes
|
272
|
+
doc = Google::Cloud::Firestore::V1::Document.new(
|
273
|
+
name: doc_path,
|
274
|
+
fields: hash_to_fields(data)
|
275
|
+
)
|
276
|
+
doc_mask = Google::Cloud::Firestore::V1::DocumentMask.new(
|
277
|
+
field_paths: field_paths.map(&:formatted_string).sort
|
278
|
+
)
|
279
|
+
Google::Cloud::Firestore::V1::Write.new(
|
280
|
+
update: doc,
|
281
|
+
update_mask: doc_mask,
|
282
|
+
update_transforms: field_transforms(field_paths_and_values)
|
283
|
+
)
|
295
284
|
end
|
296
285
|
|
297
|
-
def
|
298
|
-
writes = []
|
299
|
-
|
286
|
+
def write_for_update doc_path, data, update_time: nil
|
300
287
|
raise ArgumentError, "data is required" unless data.is_a? Hash
|
301
288
|
|
302
289
|
# Convert data to use FieldPath
|
@@ -308,11 +295,11 @@ module Google
|
|
308
295
|
# Duplicate field paths check
|
309
296
|
validate_field_paths! new_data_pairs.map(&:first)
|
310
297
|
|
311
|
-
delete_paths, new_data_pairs = new_data_pairs.partition do |
|
298
|
+
delete_paths, new_data_pairs = new_data_pairs.partition do |_field_path, value|
|
312
299
|
value.is_a?(FieldValue) && value.type == :delete
|
313
300
|
end
|
314
301
|
|
315
|
-
root_field_paths_and_values, new_data_pairs = new_data_pairs.partition do |
|
302
|
+
root_field_paths_and_values, new_data_pairs = new_data_pairs.partition do |_field_path, value|
|
316
303
|
value.is_a? FieldValue
|
317
304
|
end
|
318
305
|
|
@@ -325,7 +312,7 @@ module Google
|
|
325
312
|
data, nested_deletes = remove_field_value_from data, :delete
|
326
313
|
raise ArgumentError, "DELETE cannot be nested" if nested_deletes.any?
|
327
314
|
|
328
|
-
data, nested_field_paths_and_values
|
315
|
+
data, nested_field_paths_and_values = remove_field_value_from data
|
329
316
|
|
330
317
|
field_paths_and_values = root_field_paths_and_values.merge nested_field_paths_and_values
|
331
318
|
|
@@ -338,34 +325,31 @@ module Google
|
|
338
325
|
raise ArgumentError, "data is required"
|
339
326
|
end
|
340
327
|
|
328
|
+
write = Google::Cloud::Firestore::V1::Write.new(
|
329
|
+
update: Google::Cloud::Firestore::V1::Document.new(name: doc_path),
|
330
|
+
update_mask: Google::Cloud::Firestore::V1::DocumentMask.new,
|
331
|
+
current_document: Google::Cloud::Firestore::V1::Precondition.new(exists: true)
|
332
|
+
)
|
333
|
+
|
341
334
|
if data.any? || delete_paths.any?
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
current_document: Google::Cloud::Firestore::V1::Precondition.new(
|
349
|
-
exists: true)
|
350
|
-
)
|
335
|
+
htf = hash_to_fields data
|
336
|
+
htf.each_pair do |k, v|
|
337
|
+
write.update.fields[k] = v
|
338
|
+
end
|
339
|
+
write.update_mask.field_paths += field_paths.map(&:formatted_string).sort
|
340
|
+
|
351
341
|
if update_time
|
352
|
-
write.current_document =
|
353
|
-
|
354
|
-
|
342
|
+
write.current_document = Google::Cloud::Firestore::V1::Precondition.new(
|
343
|
+
update_time: time_to_timestamp(update_time)
|
344
|
+
)
|
355
345
|
end
|
356
|
-
writes << write
|
357
346
|
end
|
358
347
|
|
359
348
|
if field_paths_and_values.any?
|
360
|
-
|
361
|
-
if data.empty?
|
362
|
-
transform_write.current_document = \
|
363
|
-
Google::Cloud::Firestore::V1::Precondition.new(exists: true)
|
364
|
-
end
|
365
|
-
writes << transform_write
|
349
|
+
write.update_transforms += field_transforms field_paths_and_values
|
366
350
|
end
|
367
351
|
|
368
|
-
|
352
|
+
write
|
369
353
|
end
|
370
354
|
|
371
355
|
def write_for_delete doc_path, exists: nil, update_time: nil
|
@@ -387,13 +371,19 @@ module Google
|
|
387
371
|
write
|
388
372
|
end
|
389
373
|
|
390
|
-
def
|
374
|
+
def field_value_nested? obj, field_value_type = nil
|
391
375
|
return obj if obj.is_a?(FieldValue) && (field_value_type.nil? || obj.type == field_value_type)
|
392
376
|
|
393
377
|
if obj.is_a? Array
|
394
|
-
obj.each
|
378
|
+
obj.each do |o|
|
379
|
+
val = field_value_nested? o, field_value_type
|
380
|
+
return val if val
|
381
|
+
end
|
395
382
|
elsif obj.is_a? Hash
|
396
|
-
obj.each
|
383
|
+
obj.each do |_k, v|
|
384
|
+
val = field_value_nested? v, field_value_type
|
385
|
+
return val if val
|
386
|
+
end
|
397
387
|
end
|
398
388
|
nil
|
399
389
|
end
|
@@ -406,35 +396,33 @@ module Google
|
|
406
396
|
if value.is_a?(FieldValue) && (field_value_type.nil? || value.type == field_value_type)
|
407
397
|
paths << [FieldPath.new(*key), value]
|
408
398
|
nil # will be removed by calling compact
|
409
|
-
|
410
|
-
if value.
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
end
|
420
|
-
if nested_hash.empty?
|
421
|
-
nil # will be removed by calling compact
|
422
|
-
else
|
423
|
-
[String(key), nested_hash]
|
399
|
+
elsif value.is_a? Hash
|
400
|
+
if value.empty?
|
401
|
+
[String(key), value]
|
402
|
+
else
|
403
|
+
nested_hash, nested_paths = remove_field_value_from value, field_value_type
|
404
|
+
if nested_paths.any?
|
405
|
+
nested_paths.each do |nested_field_path, nested_field_value|
|
406
|
+
updated_field_paths = ([key] + nested_field_path.fields).flatten
|
407
|
+
updated_field_path = FieldPath.new(*updated_field_paths)
|
408
|
+
paths << [updated_field_path, nested_field_value]
|
424
409
|
end
|
410
|
+
end
|
411
|
+
if nested_hash.empty?
|
412
|
+
nil # will be removed by calling compact
|
425
413
|
else
|
426
|
-
[String(key),
|
414
|
+
[String(key), nested_hash]
|
427
415
|
end
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
416
|
+
end
|
417
|
+
else
|
418
|
+
if value.is_a? Array
|
419
|
+
nested_field_value = field_value_nested? value, field_value_type
|
420
|
+
if nested_field_value
|
421
|
+
raise ArgumentError, "cannot nest #{nested_field_value.type} under arrays"
|
434
422
|
end
|
435
|
-
|
436
|
-
[String(key), value]
|
437
423
|
end
|
424
|
+
|
425
|
+
[String(key), value]
|
438
426
|
end
|
439
427
|
end
|
440
428
|
|
@@ -449,14 +437,14 @@ module Google
|
|
449
437
|
if value.is_a? Hash
|
450
438
|
nested_paths = identify_leaf_nodes value
|
451
439
|
nested_paths.each do |nested_path|
|
452
|
-
paths << (
|
440
|
+
paths << ([key] + nested_path.fields).flatten
|
453
441
|
end
|
454
442
|
else
|
455
443
|
paths << [key]
|
456
444
|
end
|
457
445
|
end
|
458
446
|
|
459
|
-
paths.map { |path| FieldPath.new
|
447
|
+
paths.map { |path| FieldPath.new(*path) }
|
460
448
|
end
|
461
449
|
|
462
450
|
def identify_all_file_paths hash
|
@@ -465,15 +453,14 @@ module Google
|
|
465
453
|
hash.map do |key, value|
|
466
454
|
paths << [key]
|
467
455
|
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
end
|
456
|
+
next unless value.is_a? Hash
|
457
|
+
nested_paths = identify_all_file_paths value
|
458
|
+
nested_paths.each do |nested_path|
|
459
|
+
paths << ([key] + nested_path.fields).flatten
|
473
460
|
end
|
474
461
|
end
|
475
462
|
|
476
|
-
paths.map { |path| FieldPath.new
|
463
|
+
paths.map { |path| FieldPath.new(*path) }
|
477
464
|
end
|
478
465
|
|
479
466
|
def select_by_field_paths hash, field_paths
|
@@ -533,19 +520,19 @@ module Google
|
|
533
520
|
right_hash.each_pair do |key, right_value|
|
534
521
|
left_value = left_hash[key]
|
535
522
|
|
536
|
-
if left_value.is_a?(Hash) && right_value.is_a?(Hash)
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
523
|
+
left_hash[key] = if left_value.is_a?(Hash) && right_value.is_a?(Hash)
|
524
|
+
deep_merge_hashes left_value, right_value
|
525
|
+
else
|
526
|
+
right_value
|
527
|
+
end
|
541
528
|
end
|
542
529
|
|
543
530
|
left_hash
|
544
531
|
end
|
545
532
|
|
546
|
-
START_FIELD_PATH_CHARS = /\A[a-zA-Z_]
|
547
|
-
INVALID_FIELD_PATH_CHARS =
|
548
|
-
ESCAPED_FIELD_PATH = /\A\`(.*)\`\z
|
533
|
+
START_FIELD_PATH_CHARS = /\A[a-zA-Z_]/.freeze
|
534
|
+
INVALID_FIELD_PATH_CHARS = %r{[\~\*/\[\]]}.freeze
|
535
|
+
ESCAPED_FIELD_PATH = /\A\`(.*)\`\z/.freeze
|
549
536
|
|
550
537
|
def build_hash_from_field_paths_and_values pairs
|
551
538
|
pairs.each do |field_path, _value|
|
@@ -579,59 +566,52 @@ module Google
|
|
579
566
|
"`#{str}`"
|
580
567
|
end
|
581
568
|
|
582
|
-
def transform_write doc_path, paths
|
583
|
-
field_transforms = paths.map do |field_path, field_value|
|
584
|
-
to_field_transform field_path, field_value
|
585
|
-
end
|
586
|
-
|
587
|
-
Google::Cloud::Firestore::V1::Write.new(
|
588
|
-
transform: Google::Cloud::Firestore::V1::DocumentTransform.new(
|
589
|
-
document: doc_path,
|
590
|
-
field_transforms: field_transforms
|
591
|
-
)
|
592
|
-
)
|
593
|
-
end
|
594
|
-
|
595
569
|
def to_field_transform field_path, field_value
|
596
570
|
if field_value.type == :server_time
|
597
571
|
Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
|
598
|
-
field_path:
|
572
|
+
field_path: field_path.formatted_string,
|
599
573
|
set_to_server_value: :REQUEST_TIME
|
600
574
|
)
|
601
575
|
elsif field_value.type == :array_union
|
602
576
|
Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
|
603
|
-
field_path:
|
577
|
+
field_path: field_path.formatted_string,
|
604
578
|
append_missing_elements: raw_to_value(Array(field_value.value)).array_value
|
605
579
|
)
|
606
580
|
elsif field_value.type == :array_delete
|
607
581
|
Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
|
608
|
-
field_path:
|
582
|
+
field_path: field_path.formatted_string,
|
609
583
|
remove_all_from_array: raw_to_value(Array(field_value.value)).array_value
|
610
584
|
)
|
611
585
|
elsif field_value.type == :increment
|
612
586
|
Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
|
613
587
|
field_path: field_path.formatted_string,
|
614
|
-
increment:
|
588
|
+
increment: raw_to_value(field_value.value)
|
615
589
|
)
|
616
590
|
elsif field_value.type == :maximum
|
617
591
|
Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
|
618
592
|
field_path: field_path.formatted_string,
|
619
|
-
maximum:
|
593
|
+
maximum: raw_to_value(field_value.value)
|
620
594
|
)
|
621
595
|
elsif field_value.type == :minimum
|
622
596
|
Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
|
623
597
|
field_path: field_path.formatted_string,
|
624
|
-
minimum:
|
598
|
+
minimum: raw_to_value(field_value.value)
|
625
599
|
)
|
626
600
|
else
|
627
601
|
raise ArgumentError, "unknown field transform #{field_value.type}"
|
628
602
|
end
|
629
603
|
end
|
630
604
|
end
|
631
|
-
# rubocop:enable all
|
632
605
|
|
633
606
|
extend ClassMethods
|
634
607
|
end
|
608
|
+
# rubocop:enable Metrics/AbcSize
|
609
|
+
# rubocop:enable Metrics/BlockLength
|
610
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
611
|
+
# rubocop:enable Metrics/MethodLength
|
612
|
+
# rubocop:enable Metrics/ModuleLength
|
613
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
614
|
+
# rubocop:enable Style/CaseEquality
|
635
615
|
end
|
636
616
|
end
|
637
617
|
end
|
@@ -321,7 +321,7 @@ module Google
|
|
321
321
|
|
322
322
|
doc_path = coalesce_doc_path_argument doc
|
323
323
|
|
324
|
-
@writes << Convert.
|
324
|
+
@writes << Convert.write_for_create(doc_path, data)
|
325
325
|
|
326
326
|
nil
|
327
327
|
end
|
@@ -422,7 +422,7 @@ module Google
|
|
422
422
|
|
423
423
|
doc_path = coalesce_doc_path_argument doc
|
424
424
|
|
425
|
-
@writes << Convert.
|
425
|
+
@writes << Convert.write_for_set(doc_path, data, merge: merge)
|
426
426
|
|
427
427
|
nil
|
428
428
|
end
|
@@ -526,8 +526,8 @@ module Google
|
|
526
526
|
|
527
527
|
doc_path = coalesce_doc_path_argument doc
|
528
528
|
|
529
|
-
@writes << Convert.
|
530
|
-
|
529
|
+
@writes << Convert.write_for_update(doc_path, data,
|
530
|
+
update_time: update_time)
|
531
531
|
|
532
532
|
nil
|
533
533
|
end
|
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.4.
|
4
|
+
version: 2.4.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:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|