Skip to content

Commit

Permalink
feat: New PropertyMask field which allows partial commits, lookups, a…
Browse files Browse the repository at this point in the history
…nd query results (#7321)

PiperOrigin-RevId: 635449160
Source-Link: googleapis/googleapis@dde0ec1
Source-Link: googleapis/googleapis-gen@8caa60d
Copy-Tag: eyJwIjoiRGF0YXN0b3JlLy5Pd2xCb3QueWFtbCIsImgiOiI4Y2FhNjBkOWFlYTgyOTY0YTE5Y2RmOGZhZjkxMzg0OTExZGI4YmRkIn0=
  • Loading branch information
gcf-owl-bot[bot] authored May 22, 2024
1 parent e5e739c commit ab2938c
Show file tree
Hide file tree
Showing 6 changed files with 298 additions and 0 deletions.
Binary file modified Datastore/metadata/V1/Datastore.php
Binary file not shown.
22 changes: 22 additions & 0 deletions Datastore/src/V1/Gapic/DatastoreGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
use Google\Cloud\Datastore\V1\LookupResponse;
use Google\Cloud\Datastore\V1\Mutation;
use Google\Cloud\Datastore\V1\PartitionId;
use Google\Cloud\Datastore\V1\PropertyMask;
use Google\Cloud\Datastore\V1\Query;
use Google\Cloud\Datastore\V1\ReadOptions;
use Google\Cloud\Datastore\V1\ReserveIdsRequest;
Expand Down Expand Up @@ -414,6 +415,13 @@ public function commit($projectId, $mode, $mutations, array $optionalArgs = [])
* database.
* @type ReadOptions $readOptions
* The options for this lookup request.
* @type PropertyMask $propertyMask
* The properties to return. Defaults to returning all properties.
*
* If this field is set and an entity has a property not referenced in the
* mask, it will be absent from [LookupResponse.found.entity.properties][].
*
* The entity's key is always returned.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
Expand All @@ -440,6 +448,10 @@ public function lookup($projectId, $keys, array $optionalArgs = [])
$request->setReadOptions($optionalArgs['readOptions']);
}

if (isset($optionalArgs['propertyMask'])) {
$request->setPropertyMask($optionalArgs['propertyMask']);
}

$requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
$optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
return $this->startCall('Lookup', LookupResponse::class, $optionalArgs, $request)->wait();
Expand Down Expand Up @@ -669,6 +681,12 @@ public function runAggregationQuery($projectId, array $optionalArgs = [])
* The query to run.
* @type GqlQuery $gqlQuery
* The GQL query to run. This query must be a non-aggregation query.
* @type PropertyMask $propertyMask
* The properties to return.
* This field must not be set for a projection query.
*
* See
* [LookupRequest.property_mask][google.datastore.v1.LookupRequest.property_mask].
* @type ExplainOptions $explainOptions
* Optional. Explain options for the query. If set, additional query
* statistics will be returned. If not, only query results will be returned.
Expand Down Expand Up @@ -706,6 +724,10 @@ public function runQuery($projectId, $partitionId, array $optionalArgs = [])
$request->setGqlQuery($optionalArgs['gqlQuery']);
}

if (isset($optionalArgs['propertyMask'])) {
$request->setPropertyMask($optionalArgs['propertyMask']);
}

if (isset($optionalArgs['explainOptions'])) {
$request->setExplainOptions($optionalArgs['explainOptions']);
}
Expand Down
56 changes: 56 additions & 0 deletions Datastore/src/V1/LookupRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions Datastore/src/V1/Mutation.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 96 additions & 0 deletions Datastore/src/V1/PropertyMask.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions Datastore/src/V1/RunQueryRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ab2938c

Please sign in to comment.