Skip to content

Commit 196bdaf

Browse files
feat: Add OR query support (#1064)
* docs: changing format of the jsdoc links PiperOrigin-RevId: 509352615 Source-Link: googleapis/googleapis@b737d30 Source-Link: googleapis/googleapis-gen@8efadf3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGVmYWRmM2Q1ODc4MGVhMWM1NTAyNjhkNDZhM2RjNzAxYmEzN2ZjZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Add `OR` query support docs: Minor documentation formatting and cleanup PiperOrigin-RevId: 509848726 Source-Link: googleapis/googleapis@b9351b4 Source-Link: googleapis/googleapis-gen@99317db Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTkzMTdkYjY4MjcxODVlOGNhZThlZWI0NjEzN2NkODFjZDJkNmE1NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent dbe624b commit 196bdaf

24 files changed

+355
-91
lines changed

protos/google/datastore/v1/aggregation_result.proto

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ option ruby_package = "Google::Cloud::Datastore::V1";
3636
message AggregationResult {
3737
// The result of the aggregation functions, ex: `COUNT(*) AS total_entities`.
3838
//
39-
// The key is the [alias][google.datastore.v1.AggregationQuery.Aggregation.alias]
40-
// assigned to the aggregation function on input and the size of this map
41-
// equals the number of aggregation functions in the query.
39+
// The key is the
40+
// [alias][google.datastore.v1.AggregationQuery.Aggregation.alias] assigned to
41+
// the aggregation function on input and the size of this map equals the
42+
// number of aggregation functions in the query.
4243
map<string, Value> aggregate_properties = 2;
4344
}
4445

protos/google/datastore/v1/datastore.proto

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ message LookupResponse {
194194
// The identifier of the transaction that was started as part of this Lookup
195195
// request.
196196
//
197-
// Set only when [ReadOptions.begin_transaction][] was set in
197+
// Set only when
198+
// [ReadOptions.new_transaction][google.datastore.v1.ReadOptions.new_transaction]
199+
// was set in
198200
// [LookupRequest.read_options][google.datastore.v1.LookupRequest.read_options].
199201
bytes transaction = 5;
200202

@@ -244,7 +246,9 @@ message RunQueryResponse {
244246
// The identifier of the transaction that was started as part of this
245247
// RunQuery request.
246248
//
247-
// Set only when [ReadOptions.begin_transaction][] was set in
249+
// Set only when
250+
// [ReadOptions.new_transaction][google.datastore.v1.ReadOptions.new_transaction]
251+
// was set in
248252
// [RunQueryRequest.read_options][google.datastore.v1.RunQueryRequest.read_options].
249253
bytes transaction = 5;
250254
}
@@ -292,7 +296,9 @@ message RunAggregationQueryResponse {
292296
// The identifier of the transaction that was started as part of this
293297
// RunAggregationQuery request.
294298
//
295-
// Set only when [ReadOptions.begin_transaction][] was set in
299+
// Set only when
300+
// [ReadOptions.new_transaction][google.datastore.v1.ReadOptions.new_transaction]
301+
// was set in
296302
// [RunAggregationQueryRequest.read_options][google.datastore.v1.RunAggregationQueryRequest.read_options].
297303
bytes transaction = 5;
298304
}
@@ -378,8 +384,7 @@ message CommitRequest {
378384

379385
// Options for beginning a new transaction for this request.
380386
// The transaction is committed when the request completes. If specified,
381-
// [TransactionOptions.mode][google.datastore.v1.TransactionOptions.mode]
382-
// must be
387+
// [TransactionOptions.mode][google.datastore.v1.TransactionOptions] must be
383388
// [TransactionOptions.ReadWrite][google.datastore.v1.TransactionOptions.ReadWrite].
384389
TransactionOptions single_use_transaction = 10;
385390
}
@@ -517,6 +522,9 @@ message MutationResult {
517522
// than the version of any possible future entity.
518523
int64 version = 4;
519524

525+
// The create time of the entity. This field will not be set after a 'delete'.
526+
google.protobuf.Timestamp create_time = 7;
527+
520528
// The update time of the entity on the server after processing the mutation.
521529
// If the mutation doesn't change anything on the server, then the timestamp
522530
// will be the update timestamp of the current entity. This field will not be

protos/google/datastore/v1/entity.proto

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ option ruby_package = "Google::Cloud::Datastore::V1";
4646
//
4747
// Foreign partition IDs (in which the project ID does
4848
// not match the context project ID ) are discouraged.
49-
// Reads and writes of foreign partition IDs may fail if the project is not in an active state.
49+
// Reads and writes of foreign partition IDs may fail if the project is not in
50+
// an active state.
5051
message PartitionId {
5152
// The ID of the project to which the entities belong.
5253
string project_id = 2;
@@ -159,8 +160,8 @@ message Value {
159160
Key key_value = 5;
160161

161162
// A UTF-8 encoded string value.
162-
// When `exclude_from_indexes` is false (it is indexed) , may have at most 1500 bytes.
163-
// Otherwise, may be set to at most 1,000,000 bytes.
163+
// When `exclude_from_indexes` is false (it is indexed) , may have at most
164+
// 1500 bytes. Otherwise, may be set to at most 1,000,000 bytes.
164165
string string_value = 17;
165166

166167
// A blob value.

protos/google/datastore/v1/query.proto

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,23 @@ message EntityResult {
5656
// The version of the entity, a strictly positive number that monotonically
5757
// increases with changes to the entity.
5858
//
59-
// This field is set for [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity
60-
// results.
59+
// This field is set for
60+
// [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity results.
6161
//
62-
// For [missing][google.datastore.v1.LookupResponse.missing] entities in `LookupResponse`, this
63-
// is the version of the snapshot that was used to look up the entity, and it
64-
// is always set except for eventually consistent reads.
62+
// For [missing][google.datastore.v1.LookupResponse.missing] entities in
63+
// `LookupResponse`, this is the version of the snapshot that was used to look
64+
// up the entity, and it is always set except for eventually consistent reads.
6565
int64 version = 4;
6666

67+
// The time at which the entity was created.
68+
// This field is set for
69+
// [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity results.
70+
// If this entity is missing, this field will not be set.
71+
google.protobuf.Timestamp create_time = 6;
72+
6773
// The time at which the entity was last changed.
68-
// This field is set for [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity
69-
// results.
74+
// This field is set for
75+
// [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity results.
7076
// If this entity is missing, this field will not be set.
7177
google.protobuf.Timestamp update_time = 5;
7278

@@ -118,7 +124,8 @@ message Query {
118124
google.protobuf.Int32Value limit = 12;
119125
}
120126

121-
// Datastore query for running an aggregation over a [Query][google.datastore.v1.Query].
127+
// Datastore query for running an aggregation over a
128+
// [Query][google.datastore.v1.Query].
122129
message AggregationQuery {
123130
// Defines a aggregation that produces a single result.
124131
message Aggregation {
@@ -127,7 +134,8 @@ message AggregationQuery {
127134
// The `COUNT(*)` aggregation function operates on the entire entity
128135
// so it does not require a field reference.
129136
message Count {
130-
// Optional. Optional constraint on the maximum number of entities to count.
137+
// Optional. Optional constraint on the maximum number of entities to
138+
// count.
131139
//
132140
// This provides a way to set an upper bound on the number of entities
133141
// to scan, limiting latency and cost.
@@ -146,7 +154,8 @@ message AggregationQuery {
146154
// Requires:
147155
//
148156
// * Must be non-negative when present.
149-
google.protobuf.Int64Value up_to = 1 [(google.api.field_behavior) = OPTIONAL];
157+
google.protobuf.Int64Value up_to = 1
158+
[(google.api.field_behavior) = OPTIONAL];
150159
}
151160

152161
// The type of aggregation to perform, required.
@@ -155,7 +164,8 @@ message AggregationQuery {
155164
Count count = 1;
156165
}
157166

158-
// Optional. Optional name of the property to store the result of the aggregation.
167+
// Optional. Optional name of the property to store the result of the
168+
// aggregation.
159169
//
160170
// If not provided, Datastore will pick a default name following the format
161171
// `property_<incremental_id++>`. For example:
@@ -187,7 +197,8 @@ message AggregationQuery {
187197
// Requires:
188198
//
189199
// * Must be unique across all aggregation aliases.
190-
// * Conform to [entity property name][google.datastore.v1.Entity.properties] limitations.
200+
// * Conform to [entity property
201+
// name][google.datastore.v1.Entity.properties] limitations.
191202
string alias = 7 [(google.api.field_behavior) = OPTIONAL];
192203
}
193204

@@ -197,12 +208,14 @@ message AggregationQuery {
197208
Query nested_query = 1;
198209
}
199210

200-
// Optional. Series of aggregations to apply over the results of the `nested_query`.
211+
// Optional. Series of aggregations to apply over the results of the
212+
// `nested_query`.
201213
//
202214
// Requires:
203215
//
204216
// * A minimum of one and maximum of five aggregations per query.
205-
repeated Aggregation aggregations = 3 [(google.api.field_behavior) = OPTIONAL];
217+
repeated Aggregation aggregations = 3
218+
[(google.api.field_behavior) = OPTIONAL];
206219
}
207220

208221
// A representation of a kind.
@@ -266,6 +279,9 @@ message CompositeFilter {
266279

267280
// The results are required to satisfy each of the combined filters.
268281
AND = 1;
282+
283+
// Documents are required to satisfy at least one of the combined filters.
284+
OR = 2;
269285
}
270286

271287
// The operator for combining multiple filters.
@@ -338,6 +354,7 @@ message PropertyFilter {
338354
// Requires:
339355
//
340356
// * That `value` is an entity key.
357+
// * No other `HAS_ANCESTOR` is in the same query.
341358
HAS_ANCESTOR = 11;
342359

343360
// The value of the `property` is not in the given array.

protos/protos.d.ts

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)