google-cloud-firestore 0.24.2 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/CHANGELOG.md +26 -0
- data/EMULATOR.md +49 -0
- data/lib/google-cloud-firestore.rb +6 -1
- data/lib/google/cloud/firestore.rb +36 -8
- data/lib/google/cloud/firestore/batch.rb +1 -1
- data/lib/google/cloud/firestore/client.rb +152 -4
- data/lib/google/cloud/firestore/collection_reference.rb +1 -1
- data/lib/google/cloud/firestore/commit_response.rb +1 -1
- data/lib/google/cloud/firestore/convert.rb +53 -38
- data/lib/google/cloud/firestore/credentials.rb +2 -2
- data/lib/google/cloud/firestore/document_reference.rb +2 -1
- data/lib/google/cloud/firestore/document_snapshot.rb +5 -5
- data/lib/google/cloud/firestore/field_path.rb +2 -2
- data/lib/google/cloud/firestore/field_value.rb +139 -9
- data/lib/google/cloud/firestore/query.rb +21 -15
- data/lib/google/cloud/firestore/query_snapshot.rb +1 -1
- data/lib/google/cloud/firestore/service.rb +31 -13
- data/lib/google/cloud/firestore/transaction.rb +39 -5
- data/lib/google/cloud/firestore/v1.rb +152 -0
- data/lib/google/cloud/firestore/v1/credentials.rb +42 -0
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/common.rb +64 -0
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/document.rb +136 -0
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/firestore.rb +574 -0
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/query.rb +219 -0
- data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/write.rb +237 -0
- data/lib/google/cloud/firestore/v1/doc/google/protobuf/any.rb +130 -0
- data/lib/google/cloud/firestore/v1/doc/google/protobuf/empty.rb +29 -0
- data/lib/google/cloud/firestore/v1/doc/google/protobuf/timestamp.rb +109 -0
- data/lib/google/cloud/firestore/v1/doc/google/protobuf/wrappers.rb +26 -0
- data/lib/google/cloud/firestore/v1/doc/google/rpc/status.rb +84 -0
- data/lib/google/cloud/firestore/v1/firestore_client.rb +1044 -0
- data/lib/google/cloud/firestore/v1/firestore_client_config.json +100 -0
- data/lib/google/cloud/firestore/v1beta1.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/credentials.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/common.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/document.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/firestore.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/query.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/write.rb +41 -1
- data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/any.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/timestamp.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/wrappers.rb +1 -65
- data/lib/google/cloud/firestore/v1beta1/doc/google/rpc/status.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/firestore_client.rb +1 -1
- data/lib/google/cloud/firestore/v1beta1/firestore_client_config.json +1 -1
- data/lib/google/cloud/firestore/version.rb +1 -1
- data/lib/google/cloud/firestore/watch/enumerator_queue.rb +0 -2
- data/lib/google/cloud/firestore/watch/inventory.rb +2 -2
- data/lib/google/cloud/firestore/watch/listener.rb +16 -17
- data/lib/google/cloud/firestore/watch/order.rb +1 -1
- data/lib/google/firestore/v1/common_pb.rb +45 -0
- data/lib/google/firestore/v1/document_pb.rb +50 -0
- data/lib/google/firestore/v1/firestore_pb.rb +220 -0
- data/lib/google/firestore/v1/firestore_services_pb.rb +87 -0
- data/lib/google/firestore/v1/query_pb.rb +105 -0
- data/lib/google/firestore/v1/write_pb.rb +79 -0
- data/lib/google/firestore/v1beta1/firestore_services_pb.rb +2 -1
- data/lib/google/firestore/v1beta1/write_pb.rb +3 -0
- metadata +26 -5
@@ -84,6 +84,17 @@ module Google
|
|
84
84
|
# @param [String, DocumentReference, Array<String|DocumentReference>]
|
85
85
|
# docs One or more strings representing the path of the document, or
|
86
86
|
# document reference objects.
|
87
|
+
# @param [Array<String|FieldPath>] field_mask One or more field path
|
88
|
+
# values, representing the fields of the document to be returned. If a
|
89
|
+
# document has a field that is not present in this mask, that field
|
90
|
+
# will not be returned in the response. All fields are returned when
|
91
|
+
# the mask is not set.
|
92
|
+
#
|
93
|
+
# A field path can either be a {FieldPath} object, or a dotted string
|
94
|
+
# representing the nested fields. In other words the string represents
|
95
|
+
# individual fields joined by ".". Fields containing `~`, `*`, `/`,
|
96
|
+
# `[`, `]`, and `.` cannot be in a dotted string, and should provided
|
97
|
+
# using a {FieldPath} object instead. See {Client#field_path}.)
|
87
98
|
#
|
88
99
|
# @yield [documents] The block for accessing the document snapshots.
|
89
100
|
# @yieldparam [DocumentSnapshot] document A document snapshot.
|
@@ -102,18 +113,41 @@ module Google
|
|
102
113
|
# end
|
103
114
|
# end
|
104
115
|
#
|
105
|
-
|
116
|
+
# @example Get docs using a field mask:
|
117
|
+
# require "google/cloud/firestore"
|
118
|
+
#
|
119
|
+
# firestore = Google::Cloud::Firestore.new
|
120
|
+
#
|
121
|
+
# firestore.transaction do |tx|
|
122
|
+
# # Get and print city documents
|
123
|
+
# cities = ["cities/NYC", "cities/SF", "cities/LA"]
|
124
|
+
# tx.get_all(*cities, field_mask: :population).each do |city|
|
125
|
+
# puts "#{city.document_id} has #{city[:population]} residents."
|
126
|
+
# end
|
127
|
+
# end
|
128
|
+
#
|
129
|
+
def get_all *docs, field_mask: nil
|
106
130
|
ensure_not_closed!
|
107
131
|
ensure_service!
|
108
132
|
|
109
|
-
|
133
|
+
unless block_given?
|
134
|
+
return enum_for(:get_all, docs, field_mask: field_mask)
|
135
|
+
end
|
110
136
|
|
111
137
|
doc_paths = Array(docs).flatten.map do |doc_path|
|
112
138
|
coalesce_doc_path_argument doc_path
|
113
139
|
end
|
140
|
+
mask = Array(field_mask).map do |field_path|
|
141
|
+
if field_path.is_a? FieldPath
|
142
|
+
field_path.formatted_string
|
143
|
+
else
|
144
|
+
FieldPath.parse(field_path).formatted_string
|
145
|
+
end
|
146
|
+
end
|
147
|
+
mask = nil if mask.empty?
|
114
148
|
|
115
149
|
results = service.get_documents \
|
116
|
-
doc_paths, transaction: transaction_or_create
|
150
|
+
doc_paths, mask: mask, transaction: transaction_or_create
|
117
151
|
results.each do |result|
|
118
152
|
extract_transaction_from_result! result
|
119
153
|
next if result.result.nil?
|
@@ -665,14 +699,14 @@ module Google
|
|
665
699
|
# @private
|
666
700
|
def transaction_opt
|
667
701
|
read_write = \
|
668
|
-
Google::Firestore::
|
702
|
+
Google::Firestore::V1::TransactionOptions::ReadWrite.new
|
669
703
|
|
670
704
|
if @previous_transaction
|
671
705
|
read_write.retry_transaction = @previous_transaction
|
672
706
|
@previous_transaction = nil
|
673
707
|
end
|
674
708
|
|
675
|
-
Google::Firestore::
|
709
|
+
Google::Firestore::V1::TransactionOptions.new(
|
676
710
|
read_write: read_write
|
677
711
|
)
|
678
712
|
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# Copyright 2019 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
require "google/cloud/firestore/v1/firestore_client"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Firestore
|
21
|
+
# rubocop:disable LineLength
|
22
|
+
|
23
|
+
##
|
24
|
+
# # Ruby Client for Google Cloud Firestore API ([Beta](https://github.com/googleapis/google-cloud-ruby#versioning))
|
25
|
+
#
|
26
|
+
# [Google Cloud Firestore API][Product Documentation]:
|
27
|
+
#
|
28
|
+
# - [Product Documentation][]
|
29
|
+
#
|
30
|
+
# ## Quick Start
|
31
|
+
# In order to use this library, you first need to go through the following
|
32
|
+
# steps:
|
33
|
+
#
|
34
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
35
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
36
|
+
# 3. [Enable the Google Cloud Firestore API.](https://console.cloud.google.com/apis/library/firestore.googleapis.com)
|
37
|
+
# 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
38
|
+
#
|
39
|
+
# ### Installation
|
40
|
+
# ```
|
41
|
+
# $ gem install google-cloud-firestore
|
42
|
+
# ```
|
43
|
+
#
|
44
|
+
# ### Next Steps
|
45
|
+
# - Read the [Google Cloud Firestore API Product documentation][Product Documentation]
|
46
|
+
# to learn more about the product and see How-to Guides.
|
47
|
+
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
48
|
+
# to see the full list of Cloud APIs that we cover.
|
49
|
+
#
|
50
|
+
# [Product Documentation]: https://cloud.google.com/firestore
|
51
|
+
#
|
52
|
+
# ## Enabling Logging
|
53
|
+
#
|
54
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
55
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
56
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
57
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
58
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
59
|
+
#
|
60
|
+
# Configuring a Ruby stdlib logger:
|
61
|
+
#
|
62
|
+
# ```ruby
|
63
|
+
# require "logger"
|
64
|
+
#
|
65
|
+
# module MyLogger
|
66
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
67
|
+
# def logger
|
68
|
+
# LOGGER
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
73
|
+
# module GRPC
|
74
|
+
# extend MyLogger
|
75
|
+
# end
|
76
|
+
# ```
|
77
|
+
#
|
78
|
+
module V1
|
79
|
+
# rubocop:enable LineLength
|
80
|
+
|
81
|
+
##
|
82
|
+
# The Cloud Firestore service.
|
83
|
+
#
|
84
|
+
# This service exposes several types of comparable timestamps:
|
85
|
+
#
|
86
|
+
# * `create_time` - The time at which a document was created. Changes only
|
87
|
+
# when a document is deleted, then re-created. Increases in a strict
|
88
|
+
# monotonic fashion.
|
89
|
+
# * `update_time` - The time at which a document was last updated. Changes
|
90
|
+
# every time a document is modified. Does not change when a write results
|
91
|
+
# in no modifications. Increases in a strict monotonic fashion.
|
92
|
+
# * `read_time` - The time at which a particular state was observed. Used
|
93
|
+
# to denote a consistent snapshot of the database or the time at which a
|
94
|
+
# Document was observed to not exist.
|
95
|
+
# * `commit_time` - The time at which the writes in a transaction were
|
96
|
+
# committed. Any read with an equal or greater `read_time` is guaranteed
|
97
|
+
# to see the effects of the transaction.
|
98
|
+
#
|
99
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
100
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
101
|
+
# be many types.
|
102
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
103
|
+
# authenticating requests made by this client.
|
104
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
105
|
+
# credentials for this client.
|
106
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
107
|
+
# credentials for this client.
|
108
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
109
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
110
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
111
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
112
|
+
# metadata for requests, generally, to give OAuth credentials.
|
113
|
+
# @param scopes [Array<String>]
|
114
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
115
|
+
# an updater_proc is supplied.
|
116
|
+
# @param client_config [Hash]
|
117
|
+
# A Hash for call options for each method. See
|
118
|
+
# Google::Gax#construct_settings for the structure of
|
119
|
+
# this data. Falls back to the default config if not specified
|
120
|
+
# or the specified config is missing data points.
|
121
|
+
# @param timeout [Numeric]
|
122
|
+
# The default timeout, in seconds, for calls made through this client.
|
123
|
+
# @param metadata [Hash]
|
124
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
125
|
+
# @param exception_transformer [Proc]
|
126
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
127
|
+
# custom error handling.
|
128
|
+
def self.new \
|
129
|
+
credentials: nil,
|
130
|
+
scopes: nil,
|
131
|
+
client_config: nil,
|
132
|
+
timeout: nil,
|
133
|
+
metadata: nil,
|
134
|
+
exception_transformer: nil,
|
135
|
+
lib_name: nil,
|
136
|
+
lib_version: nil
|
137
|
+
kwargs = {
|
138
|
+
credentials: credentials,
|
139
|
+
scopes: scopes,
|
140
|
+
client_config: client_config,
|
141
|
+
timeout: timeout,
|
142
|
+
metadata: metadata,
|
143
|
+
exception_transformer: exception_transformer,
|
144
|
+
lib_name: lib_name,
|
145
|
+
lib_version: lib_version
|
146
|
+
}.select { |_, v| v != nil }
|
147
|
+
Google::Cloud::Firestore::V1::FirestoreClient.new(**kwargs)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Copyright 2019 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
require "googleauth"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Firestore
|
21
|
+
module V1
|
22
|
+
class Credentials < Google::Auth::Credentials
|
23
|
+
SCOPE = [
|
24
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
25
|
+
"https://www.googleapis.com/auth/datastore"
|
26
|
+
].freeze
|
27
|
+
PATH_ENV_VARS = %w(FIRESTORE_CREDENTIALS
|
28
|
+
FIRESTORE_KEYFILE
|
29
|
+
GOOGLE_CLOUD_CREDENTIALS
|
30
|
+
GOOGLE_CLOUD_KEYFILE
|
31
|
+
GCLOUD_KEYFILE)
|
32
|
+
JSON_ENV_VARS = %w(FIRESTORE_CREDENTIALS_JSON
|
33
|
+
FIRESTORE_KEYFILE_JSON
|
34
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
35
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
36
|
+
GCLOUD_KEYFILE_JSON)
|
37
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Copyright 2019 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
module Google
|
17
|
+
module Firestore
|
18
|
+
module V1
|
19
|
+
# A set of field paths on a document.
|
20
|
+
# Used to restrict a get or update operation on a document to a subset of its
|
21
|
+
# fields.
|
22
|
+
# This is different from standard field masks, as this is always scoped to a
|
23
|
+
# {Google::Firestore::V1::Document Document}, and takes in account the dynamic nature of {Google::Firestore::V1::Value Value}.
|
24
|
+
# @!attribute [rw] field_paths
|
25
|
+
# @return [Array<String>]
|
26
|
+
# The list of field paths in the mask. See {Google::Firestore::V1::Document#fields Document#fields} for a field
|
27
|
+
# path syntax reference.
|
28
|
+
class DocumentMask; end
|
29
|
+
|
30
|
+
# A precondition on a document, used for conditional operations.
|
31
|
+
# @!attribute [rw] exists
|
32
|
+
# @return [true, false]
|
33
|
+
# When set to `true`, the target document must exist.
|
34
|
+
# When set to `false`, the target document must not exist.
|
35
|
+
# @!attribute [rw] update_time
|
36
|
+
# @return [Google::Protobuf::Timestamp]
|
37
|
+
# When set, the target document must exist and have been last updated at
|
38
|
+
# that time.
|
39
|
+
class Precondition; end
|
40
|
+
|
41
|
+
# Options for creating a new transaction.
|
42
|
+
# @!attribute [rw] read_only
|
43
|
+
# @return [Google::Firestore::V1::TransactionOptions::ReadOnly]
|
44
|
+
# The transaction can only be used for read operations.
|
45
|
+
# @!attribute [rw] read_write
|
46
|
+
# @return [Google::Firestore::V1::TransactionOptions::ReadWrite]
|
47
|
+
# The transaction can be used for both read and write operations.
|
48
|
+
class TransactionOptions
|
49
|
+
# Options for a transaction that can be used to read and write documents.
|
50
|
+
# @!attribute [rw] retry_transaction
|
51
|
+
# @return [String]
|
52
|
+
# An optional transaction to retry.
|
53
|
+
class ReadWrite; end
|
54
|
+
|
55
|
+
# Options for a transaction that can only be used to read documents.
|
56
|
+
# @!attribute [rw] read_time
|
57
|
+
# @return [Google::Protobuf::Timestamp]
|
58
|
+
# Reads documents at the given time.
|
59
|
+
# This may not be older than 60 seconds.
|
60
|
+
class ReadOnly; end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# Copyright 2019 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
module Google
|
17
|
+
module Firestore
|
18
|
+
module V1
|
19
|
+
# A Firestore document.
|
20
|
+
#
|
21
|
+
# Must not exceed 1 MiB - 4 bytes.
|
22
|
+
# @!attribute [rw] name
|
23
|
+
# @return [String]
|
24
|
+
# The resource name of the document, for example
|
25
|
+
# `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
26
|
+
# @!attribute [rw] fields
|
27
|
+
# @return [Hash{String => Google::Firestore::V1::Value}]
|
28
|
+
# The document's fields.
|
29
|
+
#
|
30
|
+
# The map keys represent field names.
|
31
|
+
#
|
32
|
+
# A simple field name contains only characters `a` to `z`, `A` to `Z`,
|
33
|
+
# `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
|
34
|
+
# `foo_bar_17`.
|
35
|
+
#
|
36
|
+
# Field names matching the regular expression `__.*__` are reserved. Reserved
|
37
|
+
# field names are forbidden except in certain documented contexts. The map
|
38
|
+
# keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
|
39
|
+
# empty.
|
40
|
+
#
|
41
|
+
# Field paths may be used in other contexts to refer to structured fields
|
42
|
+
# defined here. For `map_value`, the field path is represented by the simple
|
43
|
+
# or quoted field names of the containing fields, delimited by `.`. For
|
44
|
+
# example, the structured field
|
45
|
+
# `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
|
46
|
+
# represented by the field path `foo.x&y`.
|
47
|
+
#
|
48
|
+
# Within a field path, a quoted field name starts and ends with `` ` `` and
|
49
|
+
# may contain any character. Some characters, including `` ` ``, must be
|
50
|
+
# escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
|
51
|
+
# `` `bak\`tik` `` represents `` bak`tik ``.
|
52
|
+
# @!attribute [rw] create_time
|
53
|
+
# @return [Google::Protobuf::Timestamp]
|
54
|
+
# Output only. The time at which the document was created.
|
55
|
+
#
|
56
|
+
# This value increases monotonically when a document is deleted then
|
57
|
+
# recreated. It can also be compared to values from other documents and
|
58
|
+
# the `read_time` of a query.
|
59
|
+
# @!attribute [rw] update_time
|
60
|
+
# @return [Google::Protobuf::Timestamp]
|
61
|
+
# Output only. The time at which the document was last changed.
|
62
|
+
#
|
63
|
+
# This value is initially set to the `create_time` then increases
|
64
|
+
# monotonically with each change to the document. It can also be
|
65
|
+
# compared to values from other documents and the `read_time` of a query.
|
66
|
+
class Document; end
|
67
|
+
|
68
|
+
# A message that can hold any of the supported value types.
|
69
|
+
# @!attribute [rw] null_value
|
70
|
+
# @return [Google::Protobuf::NullValue]
|
71
|
+
# A null value.
|
72
|
+
# @!attribute [rw] boolean_value
|
73
|
+
# @return [true, false]
|
74
|
+
# A boolean value.
|
75
|
+
# @!attribute [rw] integer_value
|
76
|
+
# @return [Integer]
|
77
|
+
# An integer value.
|
78
|
+
# @!attribute [rw] double_value
|
79
|
+
# @return [Float]
|
80
|
+
# A double value.
|
81
|
+
# @!attribute [rw] timestamp_value
|
82
|
+
# @return [Google::Protobuf::Timestamp]
|
83
|
+
# A timestamp value.
|
84
|
+
#
|
85
|
+
# Precise only to microseconds. When stored, any additional precision is
|
86
|
+
# rounded down.
|
87
|
+
# @!attribute [rw] string_value
|
88
|
+
# @return [String]
|
89
|
+
# A string value.
|
90
|
+
#
|
91
|
+
# The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
|
92
|
+
# Only the first 1,500 bytes of the UTF-8 representation are considered by
|
93
|
+
# queries.
|
94
|
+
# @!attribute [rw] bytes_value
|
95
|
+
# @return [String]
|
96
|
+
# A bytes value.
|
97
|
+
#
|
98
|
+
# Must not exceed 1 MiB - 89 bytes.
|
99
|
+
# Only the first 1,500 bytes are considered by queries.
|
100
|
+
# @!attribute [rw] reference_value
|
101
|
+
# @return [String]
|
102
|
+
# A reference to a document. For example:
|
103
|
+
# `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
104
|
+
# @!attribute [rw] geo_point_value
|
105
|
+
# @return [Google::Type::LatLng]
|
106
|
+
# A geo point value representing a point on the surface of Earth.
|
107
|
+
# @!attribute [rw] array_value
|
108
|
+
# @return [Google::Firestore::V1::ArrayValue]
|
109
|
+
# An array value.
|
110
|
+
#
|
111
|
+
# Cannot directly contain another array value, though can contain an
|
112
|
+
# map which contains another array.
|
113
|
+
# @!attribute [rw] map_value
|
114
|
+
# @return [Google::Firestore::V1::MapValue]
|
115
|
+
# A map value.
|
116
|
+
class Value; end
|
117
|
+
|
118
|
+
# An array value.
|
119
|
+
# @!attribute [rw] values
|
120
|
+
# @return [Array<Google::Firestore::V1::Value>]
|
121
|
+
# Values in the array.
|
122
|
+
class ArrayValue; end
|
123
|
+
|
124
|
+
# A map value.
|
125
|
+
# @!attribute [rw] fields
|
126
|
+
# @return [Hash{String => Google::Firestore::V1::Value}]
|
127
|
+
# The map's fields.
|
128
|
+
#
|
129
|
+
# The map keys represent field names. Field names matching the regular
|
130
|
+
# expression `__.*__` are reserved. Reserved field names are forbidden except
|
131
|
+
# in certain documented contexts. The map keys, represented as UTF-8, must
|
132
|
+
# not exceed 1,500 bytes and cannot be empty.
|
133
|
+
class MapValue; end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|