firestore: add update_transform

PiperOrigin-RevId: 297405063
This commit is contained in:
Google APIs 2020-02-26 11:19:33 -08:00 committed by Copybara-Service
parent 0aba1900ff
commit f077632ba7
5 changed files with 34 additions and 35 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";

View File

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";

View File

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
@ -66,14 +65,6 @@ service Firestore {
};
}
// Creates a new document.
rpc CreateDocument(CreateDocumentRequest) returns (Document) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/databases/*/documents/**}/{collection_id}"
body: "document"
};
}
// Updates or inserts a document.
rpc UpdateDocument(UpdateDocumentRequest) returns (Document) {
option (google.api.http) = {
@ -169,6 +160,14 @@ service Firestore {
};
option (google.api.method_signature) = "parent";
}
// Creates a new document.
rpc CreateDocument(CreateDocumentRequest) returns (Document) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/databases/*/documents/**}/{collection_id}"
body: "document"
};
}
}
// The request for [Firestore.GetDocument][google.firestore.v1.Firestore.GetDocument].

View File

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
@ -122,6 +121,15 @@ message StructuredQuery {
Value value = 3;
}
// The projection of document's fields to return.
message Projection {
// The fields to return.
//
// If empty, all fields are returned. To only return the name
// of the document, use `['__name__']`.
repeated FieldReference fields = 2;
}
// A filter with a single operand.
message UnaryFilter {
// A unary operator.
@ -146,6 +154,11 @@ message StructuredQuery {
}
}
// A reference to a field, such as `max(messages.time) as max_time`.
message FieldReference {
string field_path = 2;
}
// An order on a field.
message Order {
// The field to order by.
@ -155,20 +168,6 @@ message StructuredQuery {
Direction direction = 2;
}
// A reference to a field, such as `max(messages.time) as max_time`.
message FieldReference {
string field_path = 2;
}
// The projection of document's fields to return.
message Projection {
// The fields to return.
//
// If empty, all fields are returned. To only return the name
// of the document, use `['__name__']`.
repeated FieldReference fields = 2;
}
// A sort direction.
enum Direction {
// Unspecified.

View File

@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
@ -42,9 +41,6 @@ message Write {
string delete = 2;
// Applies a transformation to a document.
// At most one `transform` per document is allowed in a given request.
// An `update` cannot follow a `transform` on the same document in a given
// request.
DocumentTransform transform = 6;
}
@ -60,6 +56,13 @@ message Write {
// The field paths in this mask must not contain a reserved field name.
DocumentMask update_mask = 3;
// The transforms to perform after update.
//
// This field can be set only when the operation is `update`. If present, this
// write is equivalent to performing `update` and `transform` to the same
// document atomically and in order.
repeated DocumentTransform.FieldTransform update_transforms = 7;
// An optional precondition on the document.
//
// The write will fail if this is set and not met by the target document.