Skip to content

Commit

Permalink
feat: add field order_by in spanner.proto (#7339)
Browse files Browse the repository at this point in the history
feat: add field lock_hint in spanner.proto
PiperOrigin-RevId: 636759139
Source-Link: googleapis/googleapis@eeed69d
Source-Link: googleapis/googleapis-gen@8b4c5da
Copy-Tag: eyJwIjoiU3Bhbm5lci8uT3dsQm90LnlhbWwiLCJoIjoiOGI0YzVkYWUyMTU3Y2Q2ODNhOTIyOWQ0MGRlOGM3MTY2NWMyMWEwYSJ9
  • Loading branch information
gcf-owl-bot[bot] committed May 24, 2024
1 parent c2078a6 commit 73a3212
Show file tree
Hide file tree
Showing 5 changed files with 296 additions and 0 deletions.
Binary file modified Spanner/metadata/V1/Spanner.php
Binary file not shown.
42 changes: 42 additions & 0 deletions Spanner/src/V1/Gapic/SpannerGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,19 @@ public function partitionRead(
*
* If the field is set to `true` but the request does not set
* `partition_token`, the API returns an `INVALID_ARGUMENT` error.
* @type int $orderBy
* Optional. Order for the returned rows.
*
* By default, Spanner will return result rows in primary key order except for
* PartitionRead requests. For applications that do not require rows to be
* returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting
* `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval,
* resulting in lower latencies in certain cases (e.g. bulk point lookups).
* For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy}
* @type int $lockHint
* Optional. Lock Hint for the request, it can only be used with read-write
* transactions.
* For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint}
* @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 Down Expand Up @@ -1788,6 +1801,14 @@ public function read(
$request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']);
}

if (isset($optionalArgs['orderBy'])) {
$request->setOrderBy($optionalArgs['orderBy']);
}

if (isset($optionalArgs['lockHint'])) {
$request->setLockHint($optionalArgs['lockHint']);
}

$requestParams = new RequestParamsHeaderDescriptor(
$requestParamHeaders
);
Expand Down Expand Up @@ -1943,6 +1964,19 @@ public function rollback($session, $transactionId, array $optionalArgs = [])
*
* If the field is set to `true` but the request does not set
* `partition_token`, the API returns an `INVALID_ARGUMENT` error.
* @type int $orderBy
* Optional. Order for the returned rows.
*
* By default, Spanner will return result rows in primary key order except for
* PartitionRead requests. For applications that do not require rows to be
* returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting
* `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval,
* resulting in lower latencies in certain cases (e.g. bulk point lookups).
* For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy}
* @type int $lockHint
* Optional. Lock Hint for the request, it can only be used with read-write
* transactions.
* For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint}
* @type int $timeoutMillis
* Timeout to use for this call.
* }
Expand Down Expand Up @@ -1999,6 +2033,14 @@ public function streamingRead(
$request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']);
}

if (isset($optionalArgs['orderBy'])) {
$request->setOrderBy($optionalArgs['orderBy']);
}

if (isset($optionalArgs['lockHint'])) {
$request->setLockHint($optionalArgs['lockHint']);
}

$requestParams = new RequestParamsHeaderDescriptor(
$requestParamHeaders
);
Expand Down
92 changes: 92 additions & 0 deletions Spanner/src/V1/ReadRequest.php

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

95 changes: 95 additions & 0 deletions Spanner/src/V1/ReadRequest/LockHint.php

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

67 changes: 67 additions & 0 deletions Spanner/src/V1/ReadRequest/OrderBy.php

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

0 comments on commit 73a3212

Please sign in to comment.