Skip to content

Commit dde0ec1

Browse files
Google APIscopybara-github
authored andcommitted
feat: New PropertyMask field which allows partial commits, lookups, and query results
PiperOrigin-RevId: 635449160
1 parent bcaed39 commit dde0ec1

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

google/datastore/v1/datastore.proto

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ message LookupRequest {
173173

174174
// Required. Keys of entities to look up.
175175
repeated Key keys = 3 [(google.api.field_behavior) = REQUIRED];
176+
177+
// The properties to return. Defaults to returning all properties.
178+
//
179+
// If this field is set and an entity has a property not referenced in the
180+
// mask, it will be absent from [LookupResponse.found.entity.properties][].
181+
//
182+
// The entity's key is always returned.
183+
PropertyMask property_mask = 5;
176184
}
177185

178186
// The response for [Datastore.Lookup][google.datastore.v1.Datastore.Lookup].
@@ -234,6 +242,13 @@ message RunQueryRequest {
234242
GqlQuery gql_query = 7;
235243
}
236244

245+
// The properties to return.
246+
// This field must not be set for a projection query.
247+
//
248+
// See
249+
// [LookupRequest.property_mask][google.datastore.v1.LookupRequest.property_mask].
250+
PropertyMask property_mask = 10;
251+
237252
// Optional. Explain options for the query. If set, additional query
238253
// statistics will be returned. If not, only query results will be returned.
239254
ExplainOptions explain_options = 12 [(google.api.field_behavior) = OPTIONAL];
@@ -526,6 +541,16 @@ message Mutation {
526541
// mutation conflicts.
527542
google.protobuf.Timestamp update_time = 11;
528543
}
544+
545+
// The properties to write in this mutation.
546+
// None of the properties in the mask may have a reserved name, except for
547+
// `__key__`.
548+
// This field is ignored for `delete`.
549+
//
550+
// If the entity already exists, only properties referenced in the mask are
551+
// updated, others are left untouched.
552+
// Properties referenced in the mask but not in the entity are deleted.
553+
PropertyMask property_mask = 9;
529554
}
530555

531556
// The result of applying a mutation.
@@ -555,6 +580,23 @@ message MutationResult {
555580
bool conflict_detected = 5;
556581
}
557582

583+
// The set of arbitrarily nested property paths used to restrict an operation to
584+
// only a subset of properties in an entity.
585+
message PropertyMask {
586+
// The paths to the properties covered by this mask.
587+
//
588+
// A path is a list of property names separated by dots (`.`), for example
589+
// `foo.bar` means the property `bar` inside the entity property `foo` inside
590+
// the entity associated with this path.
591+
//
592+
// If a property name contains a dot `.` or a backslash `\`, then that
593+
// name must be escaped.
594+
//
595+
// A path must not be empty, and may not reference a value inside an
596+
// [array value][google.datastore.v1.Value.array_value].
597+
repeated string paths = 1;
598+
}
599+
558600
// The options shared by read requests.
559601
message ReadOptions {
560602
// The possible values for read consistencies.

0 commit comments

Comments
 (0)