Skip to content

Commit 4bfdcd3

Browse files
Google APIscopybara-github
authored andcommitted
feat: add IN/NOT_IN/NOT_EQUALS support to cloud datastore proto
PiperOrigin-RevId: 434824722
1 parent cd80397 commit 4bfdcd3

3 files changed

Lines changed: 70 additions & 21 deletions

File tree

google/datastore/v1/datastore.proto

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -328,8 +328,9 @@ message Mutation {
328328
// with the current version of the entity on the server. Conflicting mutations
329329
// are not applied, and are marked as such in MutationResult.
330330
oneof conflict_detection_strategy {
331-
// The version of the entity that this mutation is being applied to. If this
332-
// does not match the current version on the server, the mutation conflicts.
331+
// The version of the entity that this mutation is being applied
332+
// to. If this does not match the current version on the server, the
333+
// mutation conflicts.
333334
int64 base_version = 8;
334335
}
335336
}
@@ -366,9 +367,16 @@ message ReadOptions {
366367
EVENTUAL = 2;
367368
}
368369

369-
// If not specified, lookups and ancestor queries default to
370-
// `read_consistency`=`STRONG`, global queries default to
371-
// `read_consistency`=`EVENTUAL`.
370+
// For Cloud Datastore, if read_consistency is not specified, then lookups and
371+
// ancestor queries default to `read_consistency`=`STRONG`, global queries
372+
// default to `read_consistency`=`EVENTUAL`.
373+
//
374+
// For Cloud Firestore in Datastore mode, if read_consistency is not specified
375+
// then lookups and all queries default to `read_consistency`=`STRONG`.
376+
//
377+
// Explicitly setting `read_consistency`=`EVENTUAL` will result in eventually
378+
// consistent lookups & queries in both Cloud Datastore & Cloud Firestore in
379+
// Datastore mode.
372380
oneof consistency_type {
373381
// The non-transactional read consistency to use.
374382
// Cannot be set to `STRONG` for global queries.

google/datastore/v1/entity.proto

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@ syntax = "proto3";
1616

1717
package google.datastore.v1;
1818

19-
import "google/api/annotations.proto";
2019
import "google/protobuf/struct.proto";
2120
import "google/protobuf/timestamp.proto";
2221
import "google/type/latlng.proto";
@@ -47,8 +46,7 @@ option ruby_package = "Google::Cloud::Datastore::V1";
4746
//
4847
// Foreign partition IDs (in which the project ID does
4948
// not match the context project ID ) are discouraged.
50-
// Reads and writes of foreign partition IDs may fail if the project is not in
51-
// an active state.
49+
// Reads and writes of foreign partition IDs may fail if the project is not in an active state.
5250
message PartitionId {
5351
// The ID of the project to which the entities belong.
5452
string project_id = 2;
@@ -146,8 +144,8 @@ message Value {
146144
Key key_value = 5;
147145

148146
// A UTF-8 encoded string value.
149-
// When `exclude_from_indexes` is false (it is indexed), may have at most
150-
// 1500 bytes. Otherwise, may be set to at most 1,000,000 bytes.
147+
// When `exclude_from_indexes` is false (it is indexed) , may have at most 1500 bytes.
148+
// Otherwise, may be set to at most 1,000,000 bytes.
151149
string string_value = 17;
152150

153151
// A blob value.

google/datastore/v1/query.proto

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -16,10 +16,8 @@ syntax = "proto3";
1616

1717
package google.datastore.v1;
1818

19-
import "google/api/annotations.proto";
2019
import "google/datastore/v1/entity.proto";
2120
import "google/protobuf/wrappers.proto";
22-
import "google/type/latlng.proto";
2321

2422
option csharp_namespace = "Google.Cloud.Datastore.V1";
2523
option go_package = "google.golang.org/genproto/googleapis/datastore/v1;datastore";
@@ -190,23 +188,68 @@ message PropertyFilter {
190188
// Unspecified. This value must not be used.
191189
OPERATOR_UNSPECIFIED = 0;
192190

193-
// Less than.
191+
// The given `property` is less than the given `value`.
192+
//
193+
// Requires:
194+
//
195+
// * That `property` comes first in `order_by`.
194196
LESS_THAN = 1;
195197

196-
// Less than or equal.
198+
// The given `property` is less than or equal to the given `value`.
199+
//
200+
// Requires:
201+
//
202+
// * That `property` comes first in `order_by`.
197203
LESS_THAN_OR_EQUAL = 2;
198204

199-
// Greater than.
205+
// The given `property` is greater than the given `value`.
206+
//
207+
// Requires:
208+
//
209+
// * That `property` comes first in `order_by`.
200210
GREATER_THAN = 3;
201211

202-
// Greater than or equal.
212+
// The given `property` is greater than or equal to the given `value`.
213+
//
214+
// Requires:
215+
//
216+
// * That `property` comes first in `order_by`.
203217
GREATER_THAN_OR_EQUAL = 4;
204218

205-
// Equal.
219+
// The given `property` is equal to the given `value`.
206220
EQUAL = 5;
207221

208-
// Has ancestor.
222+
// The given `property` is equal to at least one value in the given array.
223+
//
224+
// Requires:
225+
//
226+
// * That `value` is a non-empty `ArrayValue` with at most 10 values.
227+
// * No other `IN` or `NOT_IN` is in the same query.
228+
IN = 6;
229+
230+
// The given `property` is not equal to the given `value`.
231+
//
232+
// Requires:
233+
//
234+
// * No other `NOT_EQUAL` or `NOT_IN` is in the same query.
235+
// * That `property` comes first in the `order_by`.
236+
NOT_EQUAL = 9;
237+
238+
// Limit the result set to the given entity and its descendants.
239+
//
240+
// Requires:
241+
//
242+
// * That `value` is an entity key.
209243
HAS_ANCESTOR = 11;
244+
245+
// The value of the `property` is not in the given array.
246+
//
247+
// Requires:
248+
//
249+
// * That `value` is a non-empty `ArrayValue` with at most 10 values.
250+
// * No other `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query.
251+
// * That `field` comes first in the `order_by`.
252+
NOT_IN = 13;
210253
}
211254

212255
// The property to filter by.

0 commit comments

Comments
 (0)