xref: /aosp_15_r20/external/googleapis/google/datastore/v1/aggregation_result.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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//     http://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
15syntax = "proto3";
16
17package google.datastore.v1;
18
19import "google/datastore/v1/entity.proto";
20import "google/datastore/v1/query.proto";
21import "google/protobuf/timestamp.proto";
22
23option csharp_namespace = "Google.Cloud.Datastore.V1";
24option go_package = "google.golang.org/genproto/googleapis/datastore/v1;datastore";
25option java_multiple_files = true;
26option java_outer_classname = "AggregationResultProto";
27option java_package = "com.google.datastore.v1";
28option php_namespace = "Google\\Cloud\\Datastore\\V1";
29option ruby_package = "Google::Cloud::Datastore::V1";
30
31// The result of a single bucket from a Datastore aggregation query.
32//
33// The keys of `aggregate_properties` are the same for all results in an
34// aggregation query, unlike entity queries which can have different fields
35// present for each result.
36message AggregationResult {
37  // The result of the aggregation functions, ex: `COUNT(*) AS total_entities`.
38  //
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.
43  map<string, Value> aggregate_properties = 2;
44}
45
46// A batch of aggregation results produced by an aggregation query.
47message AggregationResultBatch {
48  // The aggregation results for this batch.
49  repeated AggregationResult aggregation_results = 1;
50
51  // The state of the query after the current batch.
52  // Only COUNT(*) aggregations are supported in the initial launch. Therefore,
53  // expected result type is limited to `NO_MORE_RESULTS`.
54  QueryResultBatch.MoreResultsType more_results = 2;
55
56  // Read timestamp this batch was returned from.
57  //
58  // In a single transaction, subsequent query result batches for the same query
59  // can have a greater timestamp. Each batch's read timestamp
60  // is valid for all preceding batches.
61  google.protobuf.Timestamp read_time = 3;
62}
63