Skip to content

Commit

Permalink
feat: add additional field transform types (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed Jan 16, 2019
1 parent 8910533 commit e669f4e
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 10 deletions.
3 changes: 2 additions & 1 deletion dev/protos/google/firestore/v1beta1/common.proto
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,6 +11,7 @@
// 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";

Expand Down
3 changes: 2 additions & 1 deletion dev/protos/google/firestore/v1beta1/document.proto
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,6 +11,7 @@
// 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";

Expand Down
3 changes: 2 additions & 1 deletion dev/protos/google/firestore/v1beta1/firestore.proto
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,6 +11,7 @@
// 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";

Expand Down
3 changes: 2 additions & 1 deletion dev/protos/google/firestore/v1beta1/query.proto
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,6 +11,7 @@
// 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";

Expand Down
43 changes: 42 additions & 1 deletion dev/protos/google/firestore/v1beta1/write.proto
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,6 +11,7 @@
// 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";

Expand Down Expand Up @@ -89,6 +90,46 @@ message DocumentTransform {
// Sets the field to the given server value.
ServerValue set_to_server_value = 2;

// Adds the given value to the field's current value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the given value.
// If either of the given value or the current field value are doubles,
// both values will be interpreted as doubles. Double arithmetic and
// representation of double values follow IEEE 754 semantics.
// If there is positive/negative integer overflow, the field is resolved
// to the largest magnitude positive/negative integer.
Value increment = 3;

// Sets the field to the maximum of its current value and the given value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the given value.
// If a maximum operation is applied where the field and the input value
// are of mixed types (that is - one is an integer and one is a double)
// the field takes on the type of the larger operand. If the operands are
// equivalent (e.g. 3 and 3.0), the field does not change.
// 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and
// zero input value is always the stored value.
// The maximum of any numeric value x and NaN is NaN.
Value maximum = 4;

// Sets the field to the minimum of its current value and the given value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the input value.
// If a minimum operation is applied where the field and the input value
// are of mixed types (that is - one is an integer and one is a double)
// the field takes on the type of the smaller operand. If the operands are
// equivalent (e.g. 3 and 3.0), the field does not change.
// 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and
// zero input value is always the stored value.
// The minimum of any numeric value x and NaN is NaN.
Value minimum = 5;

// Append the given elements in order if they are not already present in
// the current field value.
// If the field is not an array, or if the field does not yet exist, it is
Expand Down
49 changes: 49 additions & 0 deletions dev/src/v1beta1/doc/google/firestore/v1beta1/doc_write.js
Expand Up @@ -102,6 +102,55 @@ const DocumentTransform = {
* The number should be among the values of [ServerValue]{@link
* google.firestore.v1beta1.ServerValue}
*
* @property {Object} increment
* Adds the given value to the field's current value.
*
* This must be an integer or a double value.
* If the field is not an integer or double, or if the field does not yet
* exist, the transformation will set the field to the given value.
* If either of the given value or the current field value are doubles,
* both values will be interpreted as doubles. Double arithmetic and
* representation of double values follow IEEE 754 semantics.
* If there is positive/negative integer overflow, the field is resolved
* to the largest magnitude positive/negative integer.
*
* This object should have the same structure as [Value]{@link
* google.firestore.v1beta1.Value}
*
* @property {Object} maximum
* Sets the field to the maximum of its current value and the given value.
*
* This must be an integer or a double value.
* If the field is not an integer or double, or if the field does not yet
* exist, the transformation will set the field to the given value.
* If a maximum operation is applied where the field and the input value
* are of mixed types (that is - one is an integer and one is a double)
* the field takes on the type of the larger operand. If the operands are
* equivalent (e.g. 3 and 3.0), the field does not change.
* 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and
* zero input value is always the stored value.
* The maximum of any numeric value x and NaN is NaN.
*
* This object should have the same structure as [Value]{@link
* google.firestore.v1beta1.Value}
*
* @property {Object} minimum
* Sets the field to the minimum of its current value and the given value.
*
* This must be an integer or a double value.
* If the field is not an integer or double, or if the field does not yet
* exist, the transformation will set the field to the input value.
* If a minimum operation is applied where the field and the input value
* are of mixed types (that is - one is an integer and one is a double)
* the field takes on the type of the smaller operand. If the operands are
* equivalent (e.g. 3 and 3.0), the field does not change.
* 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and
* zero input value is always the stored value.
* The minimum of any numeric value x and NaN is NaN.
*
* This object should have the same structure as [Value]{@link
* google.firestore.v1beta1.Value}
*
* @property {Object} appendMissingElements
* Append the given elements in order if they are not already present in
* the current field value.
Expand Down
10 changes: 5 additions & 5 deletions synth.metadata
@@ -1,19 +1,19 @@
{
"updateTime": "2019-01-03T17:40:22.585534Z",
"updateTime": "2019-01-16T12:08:49.785491Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.16.4",
"dockerImage": "googleapis/artman@sha256:8b45fae963557c3299921037ecbb86f0689f41b1b4aea73408ebc50562cb2857"
"version": "0.16.5",
"dockerImage": "googleapis/artman@sha256:5a96c2c5c6f9570cc9556b63dc9ce1838777fd9166b5b64e43ad8e0ecee2fe2c"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "2a5caab4315cb5ab3d5c97c90c6d4e9441052b16",
"internalRef": "227195651"
"sha": "7a81902f287a4ac2ac130994889c80f87f91d035",
"internalRef": "229452079"
}
},
{
Expand Down

0 comments on commit e669f4e

Please sign in to comment.