From 1f86dd56789064ca013633f4138552eaf836c0d6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 05:52:14 +0000 Subject: [PATCH] build: update Node.js generator to compile protos (#1945) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 582493526 Source-Link: https://togithub.com/googleapis/googleapis/commit/7c4e4b52369c9f6ac3e78f945d36fc833f2280de Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/368cfb651016d6a93ca6e488cbc34e2d1d9d212c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzY4Y2ZiNjUxMDE2ZDZhOTNjYTZlNDg4Y2JjMzRlMmQxZDlkMjEyYyJ9 BEGIN_NESTED_COMMIT feat(spanner): add directed_read_option in spanner.proto docs(spanner): updated comment formatting PiperOrigin-RevId: 578551679 Source-Link: https://togithub.com/googleapis/googleapis/commit/7c80b961d092ff59576df0eba672958b4954bc4b Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/7b1172ba5e020eaef7de75062a576a11b8e117e4 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2IxMTcyYmE1ZTAyMGVhZWY3ZGU3NTA2MmE1NzZhMTFiOGUxMTdlNCJ9 END_NESTED_COMMIT BEGIN_NESTED_COMMIT feat: add PG.OID type cod annotation PiperOrigin-RevId: 577053414 Source-Link: https://togithub.com/googleapis/googleapis/commit/727c286eca5aa03d3354d6406a67f6a294c15f1c Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/2015275a7dda2ad3d1609f06c4208125c7de8a9d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjAxNTI3NWE3ZGRhMmFkM2QxNjA5ZjA2YzQyMDgxMjVjN2RlOGE5ZCJ9 END_NESTED_COMMIT --- protos/google/spanner/v1/spanner.proto | 399 +++--- protos/google/spanner/v1/type.proto | 7 +- protos/protos.d.ts | 437 ++++++- protos/protos.js | 1552 ++++++++++++++++++++---- protos/protos.json | 76 +- src/v1/spanner_client.ts | 276 +++-- 6 files changed, 2245 insertions(+), 502 deletions(-) diff --git a/protos/google/spanner/v1/spanner.proto b/protos/google/spanner/v1/spanner.proto index 68d31a47b..367928a45 100644 --- a/protos/google/spanner/v1/spanner.proto +++ b/protos/google/spanner/v1/spanner.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ syntax = "proto3"; package google.spanner.v1; +import public "google/spanner/v1/commit_response.proto"; + import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; @@ -24,7 +26,6 @@ import "google/protobuf/empty.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; -import public "google/spanner/v1/commit_response.proto"; import "google/spanner/v1/keys.proto"; import "google/spanner/v1/mutation.proto"; import "google/spanner/v1/result_set.proto"; @@ -84,7 +85,8 @@ service Spanner { // // This API can be used to initialize a session cache on the clients. // See https://goo.gl/TgSFN2 for best practices on session cache management. - rpc BatchCreateSessions(BatchCreateSessionsRequest) returns (BatchCreateSessionsResponse) { + rpc BatchCreateSessions(BatchCreateSessionsRequest) + returns (BatchCreateSessionsResponse) { option (google.api.http) = { post: "/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate" body: "*" @@ -127,10 +129,12 @@ service Spanner { // // Operations inside read-write transactions might return `ABORTED`. If // this occurs, the application should restart the transaction from - // the beginning. See [Transaction][google.spanner.v1.Transaction] for more details. + // the beginning. See [Transaction][google.spanner.v1.Transaction] for more + // details. // // Larger result sets can be fetched in streaming fashion by calling - // [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] instead. + // [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] + // instead. rpc ExecuteSql(ExecuteSqlRequest) returns (ResultSet) { option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeSql" @@ -138,11 +142,11 @@ service Spanner { }; } - // Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the result - // set as a stream. Unlike [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there - // is no limit on the size of the returned result set. However, no - // individual row in the result set can exceed 100 MiB, and no - // column value can exceed 10 MiB. + // Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the + // result set as a stream. Unlike + // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on + // the size of the returned result set. However, no individual row in the + // result set can exceed 100 MiB, and no column value can exceed 10 MiB. rpc ExecuteStreamingSql(ExecuteSqlRequest) returns (stream PartialResultSet) { option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeStreamingSql" @@ -155,13 +159,15 @@ service Spanner { // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. // // Statements are executed in sequential order. A request can succeed even if - // a statement fails. The [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] field in the - // response provides information about the statement that failed. Clients must - // inspect this field to determine whether an error occurred. + // a statement fails. The + // [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] + // field in the response provides information about the statement that failed. + // Clients must inspect this field to determine whether an error occurred. // // Execution stops after the first failed statement; the remaining statements // are not executed. - rpc ExecuteBatchDml(ExecuteBatchDmlRequest) returns (ExecuteBatchDmlResponse) { + rpc ExecuteBatchDml(ExecuteBatchDmlRequest) + returns (ExecuteBatchDmlResponse) { option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml" body: "*" @@ -170,14 +176,15 @@ service Spanner { // Reads rows from the database using key lookups and scans, as a // simple key/value style alternative to - // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be used to - // return a result set larger than 10 MiB; if the read matches more + // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be + // used to return a result set larger than 10 MiB; if the read matches more // data than that, the read fails with a `FAILED_PRECONDITION` // error. // // Reads inside read-write transactions might return `ABORTED`. If // this occurs, the application should restart the transaction from - // the beginning. See [Transaction][google.spanner.v1.Transaction] for more details. + // the beginning. See [Transaction][google.spanner.v1.Transaction] for more + // details. // // Larger result sets can be yielded in streaming fashion by calling // [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. @@ -188,9 +195,9 @@ service Spanner { }; } - // Like [Read][google.spanner.v1.Spanner.Read], except returns the result set as a - // stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no limit on the - // size of the returned result set. However, no individual row in + // Like [Read][google.spanner.v1.Spanner.Read], except returns the result set + // as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no + // limit on the size of the returned result set. However, no individual row in // the result set can exceed 100 MiB, and no column value can exceed // 10 MiB. rpc StreamingRead(ReadRequest) returns (stream PartialResultSet) { @@ -201,7 +208,8 @@ service Spanner { } // Begins a new transaction. This step can often be skipped: - // [Read][google.spanner.v1.Spanner.Read], [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and + // [Read][google.spanner.v1.Spanner.Read], + // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and // [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a // side-effect. rpc BeginTransaction(BeginTransactionRequest) returns (Transaction) { @@ -232,13 +240,15 @@ service Spanner { body: "*" }; option (google.api.method_signature) = "session,transaction_id,mutations"; - option (google.api.method_signature) = "session,single_use_transaction,mutations"; + option (google.api.method_signature) = + "session,single_use_transaction,mutations"; } // Rolls back a transaction, releasing any locks it holds. It is a good // idea to call this for any transaction that includes one or more - // [Read][google.spanner.v1.Spanner.Read] or [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and - // ultimately decides not to commit. + // [Read][google.spanner.v1.Spanner.Read] or + // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately + // decides not to commit. // // `Rollback` returns `OK` if it successfully aborts the transaction, the // transaction was already aborted, or the transaction is not @@ -253,10 +263,11 @@ service Spanner { // Creates a set of partition tokens that can be used to execute a query // operation in parallel. Each of the returned partition tokens can be used - // by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to specify a subset - // of the query result to read. The same session and read-only transaction - // must be used by the PartitionQueryRequest used to create the - // partition tokens and the ExecuteSqlRequests that use the partition tokens. + // by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to + // specify a subset of the query result to read. The same session and + // read-only transaction must be used by the PartitionQueryRequest used to + // create the partition tokens and the ExecuteSqlRequests that use the + // partition tokens. // // Partition tokens become invalid when the session used to create them // is deleted, is idle for too long, begins a new transaction, or becomes too @@ -271,12 +282,13 @@ service Spanner { // Creates a set of partition tokens that can be used to execute a read // operation in parallel. Each of the returned partition tokens can be used - // by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a subset of the read - // result to read. The same session and read-only transaction must be used by - // the PartitionReadRequest used to create the partition tokens and the - // ReadRequests that use the partition tokens. There are no ordering - // guarantees on rows returned among the returned partition tokens, or even - // within each individual StreamingRead call issued with a partition_token. + // by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a + // subset of the read result to read. The same session and read-only + // transaction must be used by the PartitionReadRequest used to create the + // partition tokens and the ReadRequests that use the partition tokens. There + // are no ordering guarantees on rows returned among the returned partition + // tokens, or even within each individual StreamingRead call issued with a + // partition_token. // // Partition tokens become invalid when the session used to create them // is deleted, is idle for too long, begins a new transaction, or becomes too @@ -327,7 +339,8 @@ message CreateSessionRequest { Session session = 2 [(google.api.field_behavior) = REQUIRED]; } -// The request for [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. +// The request for +// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. message BatchCreateSessionsRequest { // Required. The database in which the new sessions are created. string database = 1 [ @@ -344,11 +357,13 @@ message BatchCreateSessionsRequest { // The API may return fewer than the requested number of sessions. If a // specific number of sessions are desired, the client can make additional // calls to BatchCreateSessions (adjusting - // [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] as necessary). + // [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] + // as necessary). int32 session_count = 3 [(google.api.field_behavior) = REQUIRED]; } -// The response for [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. +// The response for +// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. message BatchCreateSessionsResponse { // The freshly created sessions. repeated Session session = 1; @@ -376,11 +391,13 @@ message Session { map labels = 2; // Output only. The timestamp when the session is created. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The approximate timestamp when the session is last used. It is // typically earlier than the actual last use time. - google.protobuf.Timestamp approximate_last_use_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp approximate_last_use_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The database role which created this session. string creator_role = 5; @@ -391,9 +408,7 @@ message GetSessionRequest { // Required. The name of the session to retrieve. string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; } @@ -412,7 +427,8 @@ message ListSessionsRequest { int32 page_size = 2; // If non-empty, `page_token` should contain a - // [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] from a previous + // [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] + // from a previous // [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. string page_token = 3; @@ -435,8 +451,8 @@ message ListSessionsResponse { repeated Session sessions = 1; // `next_page_token` can be sent in a subsequent - // [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more of the matching - // sessions. + // [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more + // of the matching sessions. string next_page_token = 2; } @@ -445,9 +461,7 @@ message DeleteSessionRequest { // Required. The name of the session to delete. string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; } @@ -512,6 +526,86 @@ message RequestOptions { string transaction_tag = 3; } +// The DirectedReadOptions can be used to indicate which replicas or regions +// should be used for non-transactional reads or queries. +// +// DirectedReadOptions may only be specified for a read-only transaction, +// otherwise the API will return an `INVALID_ARGUMENT` error. +message DirectedReadOptions { + // The directed read replica selector. + // Callers must provide one or more of the following fields for replica + // selection: + // + // * `location` - The location must be one of the regions within the + // multi-region configuration of your database. + // * `type` - The type of the replica. + // + // Some examples of using replica_selectors are: + // + // * `location:us-east1` --> The "us-east1" replica(s) of any available type + // will be used to process the request. + // * `type:READ_ONLY` --> The "READ_ONLY" type replica(s) in nearest + // . available location will be used to process the + // request. + // * `location:us-east1 type:READ_ONLY` --> The "READ_ONLY" type replica(s) + // in location "us-east1" will be used to process + // the request. + message ReplicaSelection { + // Indicates the type of replica. + enum Type { + // Not specified. + TYPE_UNSPECIFIED = 0; + + // Read-write replicas support both reads and writes. + READ_WRITE = 1; + + // Read-only replicas only support reads (not writes). + READ_ONLY = 2; + } + + // The location or region of the serving requests, e.g. "us-east1". + string location = 1; + + // The type of replica. + Type type = 2; + } + + // An IncludeReplicas contains a repeated set of ReplicaSelection which + // indicates the order in which replicas should be considered. + message IncludeReplicas { + // The directed read replica selector. + repeated ReplicaSelection replica_selections = 1; + + // If true, Spanner will not route requests to a replica outside the + // include_replicas list when all of the specified replicas are unavailable + // or unhealthy. Default value is `false`. + bool auto_failover_disabled = 2; + } + + // An ExcludeReplicas contains a repeated set of ReplicaSelection that should + // be excluded from serving requests. + message ExcludeReplicas { + // The directed read replica selector. + repeated ReplicaSelection replica_selections = 1; + } + + // Required. Replicas indicates the order in which replicas should be + // considered. At most one of either include_replicas or exclude_replicas + // should be present in the message. + oneof replicas { + // Include_replicas indicates the order of replicas (as they appear in + // this list) to process the request. If auto_failover_disabled is set to + // true and all replicas are exhausted without finding a healthy replica, + // Spanner will wait for a replica in the list to become available, requests + // may fail due to `DEADLINE_EXCEEDED` errors. + IncludeReplicas include_replicas = 1; + + // Exclude_replicas indicates that should be excluded from serving + // requests. Spanner will not route requests to the replicas in this list. + ExcludeReplicas exclude_replicas = 2; + } +} + // The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and // [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]. message ExecuteSqlRequest { @@ -585,9 +679,7 @@ message ExecuteSqlRequest { // Required. The session in which the SQL query should be performed. string session = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; // The transaction to use. @@ -622,7 +714,8 @@ message ExecuteSqlRequest { // It is not always possible for Cloud Spanner to infer the right SQL type // from a JSON value. For example, values of type `BYTES` and values - // of type `STRING` both appear in [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + // of type `STRING` both appear in + // [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. // // In these cases, `param_types` can be used to specify the exact // SQL type for some or all of the SQL statement parameters. See the @@ -632,15 +725,18 @@ message ExecuteSqlRequest { // If this request is resuming a previously interrupted SQL statement // execution, `resume_token` should be copied from the last - // [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the interruption. Doing this - // enables the new SQL statement execution to resume where the last one left - // off. The rest of the request parameters must exactly match the - // request that yielded this token. + // [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + // interruption. Doing this enables the new SQL statement execution to resume + // where the last one left off. The rest of the request parameters must + // exactly match the request that yielded this token. bytes resume_token = 6; // Used to control the amount of debugging information returned in - // [ResultSetStats][google.spanner.v1.ResultSetStats]. If [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only - // be set to [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. + // [ResultSetStats][google.spanner.v1.ResultSetStats]. If + // [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is + // set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + // be set to + // [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. QueryMode query_mode = 7; // If present, results will be restricted to the specified partition @@ -667,11 +763,14 @@ message ExecuteSqlRequest { // Common options for this request. RequestOptions request_options = 11; + // Directed read options for this request. + DirectedReadOptions directed_read_options = 15; + // If this is for a partitioned query and this field is set to `true`, the - // request will be executed via Spanner independent compute resources. + // request is executed with Spanner Data Boost independent compute resources. // // If the field is set to `true` but the request does not set - // `partition_token`, the API will return an `INVALID_ARGUMENT` error. + // `partition_token`, the API returns an `INVALID_ARGUMENT` error. bool data_boost_enabled = 16; } @@ -698,7 +797,9 @@ message ExecuteBatchDmlRequest { // It is not always possible for Cloud Spanner to infer the right SQL type // from a JSON value. For example, values of type `BYTES` and values - // of type `STRING` both appear in [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as JSON strings. + // of type `STRING` both appear in + // [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as + // JSON strings. // // In these cases, `param_types` can be used to specify the exact // SQL type for some or all of the SQL statement parameters. See the @@ -710,9 +811,7 @@ message ExecuteBatchDmlRequest { // Required. The session in which the DML statements should be performed. string session = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; // Required. The transaction to use. Must be a read-write transaction. @@ -722,17 +821,17 @@ message ExecuteBatchDmlRequest { // transaction. TransactionSelector transaction = 2 [(google.api.field_behavior) = REQUIRED]; - // Required. The list of statements to execute in this batch. Statements are executed - // serially, such that the effects of statement `i` are visible to statement - // `i+1`. Each statement must be a DML statement. Execution stops at the - // first failed statement; the remaining statements are not executed. + // Required. The list of statements to execute in this batch. Statements are + // executed serially, such that the effects of statement `i` are visible to + // statement `i+1`. Each statement must be a DML statement. Execution stops at + // the first failed statement; the remaining statements are not executed. // // Callers must provide at least one statement. repeated Statement statements = 3 [(google.api.field_behavior) = REQUIRED]; - // Required. A per-transaction sequence number used to identify this request. This field - // makes each request idempotent such that if the request is received multiple - // times, at most one will succeed. + // Required. A per-transaction sequence number used to identify this request. + // This field makes each request idempotent such that if the request is + // received multiple times, at most one will succeed. // // The sequence number must be monotonically increasing within the // transaction. If a request arrives for the first time with an out-of-order @@ -744,38 +843,47 @@ message ExecuteBatchDmlRequest { RequestOptions request_options = 5; } -// The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list -// of [ResultSet][google.spanner.v1.ResultSet] messages, one for each DML statement that has successfully -// executed, in the same order as the statements in the request. If a statement -// fails, the status in the response body identifies the cause of the failure. +// The response for +// [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list +// of [ResultSet][google.spanner.v1.ResultSet] messages, one for each DML +// statement that has successfully executed, in the same order as the statements +// in the request. If a statement fails, the status in the response body +// identifies the cause of the failure. // // To check for DML statements that failed, use the following approach: // -// 1. Check the status in the response message. The [google.rpc.Code][google.rpc.Code] enum +// 1. Check the status in the response message. The +// [google.rpc.Code][google.rpc.Code] enum // value `OK` indicates that all statements were executed successfully. // 2. If the status was not `OK`, check the number of result sets in the -// response. If the response contains `N` [ResultSet][google.spanner.v1.ResultSet] messages, then -// statement `N+1` in the request failed. +// response. If the response contains `N` +// [ResultSet][google.spanner.v1.ResultSet] messages, then statement `N+1` in +// the request failed. // // Example 1: // // * Request: 5 DML statements, all executed successfully. -// * Response: 5 [ResultSet][google.spanner.v1.ResultSet] messages, with the status `OK`. +// * Response: 5 [ResultSet][google.spanner.v1.ResultSet] messages, with the +// status `OK`. // // Example 2: // // * Request: 5 DML statements. The third statement has a syntax error. -// * Response: 2 [ResultSet][google.spanner.v1.ResultSet] messages, and a syntax error (`INVALID_ARGUMENT`) -// status. The number of [ResultSet][google.spanner.v1.ResultSet] messages indicates that the third -// statement failed, and the fourth and fifth statements were not executed. +// * Response: 2 [ResultSet][google.spanner.v1.ResultSet] messages, and a syntax +// error (`INVALID_ARGUMENT`) +// status. The number of [ResultSet][google.spanner.v1.ResultSet] messages +// indicates that the third statement failed, and the fourth and fifth +// statements were not executed. message ExecuteBatchDmlResponse { - // One [ResultSet][google.spanner.v1.ResultSet] for each statement in the request that ran successfully, - // in the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] does - // not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] contain - // the number of rows modified by the statement. + // One [ResultSet][google.spanner.v1.ResultSet] for each statement in the + // request that ran successfully, in the same order as the statements in the + // request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any + // rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each + // [ResultSet][google.spanner.v1.ResultSet] contain the number of rows + // modified by the statement. // - // Only the first [ResultSet][google.spanner.v1.ResultSet] in the response contains valid - // [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. + // Only the first [ResultSet][google.spanner.v1.ResultSet] in the response + // contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. repeated ResultSet result_sets = 1; // If all DML statements are executed successfully, the status is `OK`. @@ -810,24 +918,23 @@ message PartitionQueryRequest { // Required. The session used to create the partitions. string session = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; // Read only snapshot transactions are supported, read/write and single use // transactions are not. TransactionSelector transaction = 2; - // Required. The query request to generate partitions for. The request will fail if - // the query is not root partitionable. The query plan of a root - // partitionable query has a single distributed union operator. A distributed - // union operator conceptually divides one or more tables into multiple - // splits, remotely evaluates a subquery independently on each split, and - // then unions all results. + // Required. The query request to generate partitions for. The request will + // fail if the query is not root partitionable. For a query to be root + // partitionable, it needs to satisfy a few conditions. For example, the first + // operator in the query execution plan must be a distributed union operator. + // For more information about other conditions, see [Read data in + // parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). // - // This must not contain DML commands, such as INSERT, UPDATE, or - // DELETE. Use [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a + // The query request must not contain DML commands, such as INSERT, UPDATE, or + // DELETE. Use + // [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a // PartitionedDml transaction for large, partition-friendly DML operations. string sql = 3 [(google.api.field_behavior) = REQUIRED]; @@ -847,7 +954,8 @@ message PartitionQueryRequest { // It is not always possible for Cloud Spanner to infer the right SQL type // from a JSON value. For example, values of type `BYTES` and values - // of type `STRING` both appear in [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. + // of type `STRING` both appear in + // [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. // // In these cases, `param_types` can be used to specify the exact // SQL type for some or all of the SQL query parameters. See the @@ -864,9 +972,7 @@ message PartitionReadRequest { // Required. The session used to create the partitions. string session = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; // Read only snapshot transactions are supported, read/write and single use @@ -876,18 +982,24 @@ message PartitionReadRequest { // Required. The name of the table in the database to be read. string table = 3 [(google.api.field_behavior) = REQUIRED]; - // If non-empty, the name of an index on [table][google.spanner.v1.PartitionReadRequest.table]. This index is - // used instead of the table primary key when interpreting [key_set][google.spanner.v1.PartitionReadRequest.key_set] - // and sorting result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] for further information. + // If non-empty, the name of an index on + // [table][google.spanner.v1.PartitionReadRequest.table]. This index is used + // instead of the table primary key when interpreting + // [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting + // result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] + // for further information. string index = 4; - // The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be returned for each row matching - // this request. + // The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be + // returned for each row matching this request. repeated string columns = 5; // Required. `key_set` identifies the rows to be yielded. `key_set` names the - // primary keys of the rows in [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless [index][google.spanner.v1.PartitionReadRequest.index] - // is present. If [index][google.spanner.v1.PartitionReadRequest.index] is present, then [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names + // primary keys of the rows in + // [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless + // [index][google.spanner.v1.PartitionReadRequest.index] is present. If + // [index][google.spanner.v1.PartitionReadRequest.index] is present, then + // [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names // index keys in [index][google.spanner.v1.PartitionReadRequest.index]. // // It is not an error for the `key_set` to name rows that do not @@ -923,9 +1035,7 @@ message ReadRequest { // Required. The session in which the read should be performed. string session = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; // The transaction to use. If none is provided, the default is a @@ -935,24 +1045,31 @@ message ReadRequest { // Required. The name of the table in the database to be read. string table = 3 [(google.api.field_behavior) = REQUIRED]; - // If non-empty, the name of an index on [table][google.spanner.v1.ReadRequest.table]. This index is - // used instead of the table primary key when interpreting [key_set][google.spanner.v1.ReadRequest.key_set] - // and sorting result rows. See [key_set][google.spanner.v1.ReadRequest.key_set] for further information. + // If non-empty, the name of an index on + // [table][google.spanner.v1.ReadRequest.table]. This index is used instead of + // the table primary key when interpreting + // [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. + // See [key_set][google.spanner.v1.ReadRequest.key_set] for further + // information. string index = 4; - // Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be returned for each row matching - // this request. + // Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be + // returned for each row matching this request. repeated string columns = 5 [(google.api.field_behavior) = REQUIRED]; // Required. `key_set` identifies the rows to be yielded. `key_set` names the - // primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to be yielded, unless [index][google.spanner.v1.ReadRequest.index] - // is present. If [index][google.spanner.v1.ReadRequest.index] is present, then [key_set][google.spanner.v1.ReadRequest.key_set] instead names - // index keys in [index][google.spanner.v1.ReadRequest.index]. + // primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to + // be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. + // If [index][google.spanner.v1.ReadRequest.index] is present, then + // [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys + // in [index][google.spanner.v1.ReadRequest.index]. // - // If the [partition_token][google.spanner.v1.ReadRequest.partition_token] field is empty, rows are yielded - // in table primary key order (if [index][google.spanner.v1.ReadRequest.index] is empty) or index key order - // (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the [partition_token][google.spanner.v1.ReadRequest.partition_token] field is not - // empty, rows will be yielded in an unspecified order. + // If the [partition_token][google.spanner.v1.ReadRequest.partition_token] + // field is empty, rows are yielded in table primary key order (if + // [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + // (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the + // [partition_token][google.spanner.v1.ReadRequest.partition_token] field is + // not empty, rows will be yielded in an unspecified order. // // It is not an error for the `key_set` to name rows that do not // exist in the database. Read yields nothing for nonexistent rows. @@ -965,9 +1082,9 @@ message ReadRequest { // If this request is resuming a previously interrupted read, // `resume_token` should be copied from the last - // [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the interruption. Doing this - // enables the new read to resume where the last read left off. The - // rest of the request parameters must exactly match the request + // [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + // interruption. Doing this enables the new read to resume where the last read + // left off. The rest of the request parameters must exactly match the request // that yielded this token. bytes resume_token = 9; @@ -980,22 +1097,24 @@ message ReadRequest { // Common options for this request. RequestOptions request_options = 11; + // Directed read options for this request. + DirectedReadOptions directed_read_options = 14; + // If this is for a partitioned read and this field is set to `true`, the - // request will be executed via Spanner independent compute resources. + // request is executed with Spanner Data Boost independent compute resources. // // If the field is set to `true` but the request does not set - // `partition_token`, the API will return an `INVALID_ARGUMENT` error. + // `partition_token`, the API returns an `INVALID_ARGUMENT` error. bool data_boost_enabled = 15; } -// The request for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction]. +// The request for +// [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction]. message BeginTransactionRequest { // Required. The session in which the transaction runs. string session = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; // Required. Options for the new transaction. @@ -1014,9 +1133,7 @@ message CommitRequest { // Required. The session in which the transaction to be committed is running. string session = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; // Required. The transaction in which to commit. @@ -1042,8 +1159,8 @@ message CommitRequest { repeated Mutation mutations = 4; // If `true`, then statistics related to the transaction will be included in - // the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. Default value is - // `false`. + // the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. + // Default value is `false`. bool return_commit_stats = 5; // Common options for this request. @@ -1055,9 +1172,7 @@ message RollbackRequest { // Required. The session in which the transaction to roll back is running. string session = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "spanner.googleapis.com/Session" - } + (google.api.resource_reference) = { type: "spanner.googleapis.com/Session" } ]; // Required. The transaction to roll back. diff --git a/protos/google/spanner/v1/type.proto b/protos/google/spanner/v1/type.proto index 290b5540d..412cfa126 100644 --- a/protos/google/spanner/v1/type.proto +++ b/protos/google/spanner/v1/type.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -171,4 +171,9 @@ enum TypeAnnotationCode { // [JSON][google.spanner.v1.TypeCode.JSON] when a client interacts with PostgreSQL-enabled // Spanner databases. PG_JSONB = 3; + + // PostgreSQL compatible OID type. This annotation can be used by a client + // interacting with PostgreSQL-enabled Spanner database to specify that a + // value should be treated using the semantics of the OID type. + PG_OID = 4; } diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 0ca40c97d..99ec6fff4 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -17299,7 +17299,8 @@ export namespace google { enum TypeAnnotationCode { TYPE_ANNOTATION_CODE_UNSPECIFIED = 0, PG_NUMERIC = 2, - PG_JSONB = 3 + PG_JSONB = 3, + PG_OID = 4 } /** Represents a Spanner */ @@ -18624,6 +18625,428 @@ export namespace google { } } + /** Properties of a DirectedReadOptions. */ + interface IDirectedReadOptions { + + /** DirectedReadOptions includeReplicas */ + includeReplicas?: (google.spanner.v1.DirectedReadOptions.IIncludeReplicas|null); + + /** DirectedReadOptions excludeReplicas */ + excludeReplicas?: (google.spanner.v1.DirectedReadOptions.IExcludeReplicas|null); + } + + /** Represents a DirectedReadOptions. */ + class DirectedReadOptions implements IDirectedReadOptions { + + /** + * Constructs a new DirectedReadOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.v1.IDirectedReadOptions); + + /** DirectedReadOptions includeReplicas. */ + public includeReplicas?: (google.spanner.v1.DirectedReadOptions.IIncludeReplicas|null); + + /** DirectedReadOptions excludeReplicas. */ + public excludeReplicas?: (google.spanner.v1.DirectedReadOptions.IExcludeReplicas|null); + + /** DirectedReadOptions replicas. */ + public replicas?: ("includeReplicas"|"excludeReplicas"); + + /** + * Creates a new DirectedReadOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns DirectedReadOptions instance + */ + public static create(properties?: google.spanner.v1.IDirectedReadOptions): google.spanner.v1.DirectedReadOptions; + + /** + * Encodes the specified DirectedReadOptions message. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.verify|verify} messages. + * @param message DirectedReadOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.v1.IDirectedReadOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DirectedReadOptions message, length delimited. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.verify|verify} messages. + * @param message DirectedReadOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.v1.IDirectedReadOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DirectedReadOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DirectedReadOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.v1.DirectedReadOptions; + + /** + * Decodes a DirectedReadOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DirectedReadOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.v1.DirectedReadOptions; + + /** + * Verifies a DirectedReadOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DirectedReadOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DirectedReadOptions + */ + public static fromObject(object: { [k: string]: any }): google.spanner.v1.DirectedReadOptions; + + /** + * Creates a plain object from a DirectedReadOptions message. Also converts values to other types if specified. + * @param message DirectedReadOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.v1.DirectedReadOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DirectedReadOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DirectedReadOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DirectedReadOptions { + + /** Properties of a ReplicaSelection. */ + interface IReplicaSelection { + + /** ReplicaSelection location */ + location?: (string|null); + + /** ReplicaSelection type */ + type?: (google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type|keyof typeof google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type|null); + } + + /** Represents a ReplicaSelection. */ + class ReplicaSelection implements IReplicaSelection { + + /** + * Constructs a new ReplicaSelection. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.v1.DirectedReadOptions.IReplicaSelection); + + /** ReplicaSelection location. */ + public location: string; + + /** ReplicaSelection type. */ + public type: (google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type|keyof typeof google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type); + + /** + * Creates a new ReplicaSelection instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplicaSelection instance + */ + public static create(properties?: google.spanner.v1.DirectedReadOptions.IReplicaSelection): google.spanner.v1.DirectedReadOptions.ReplicaSelection; + + /** + * Encodes the specified ReplicaSelection message. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.ReplicaSelection.verify|verify} messages. + * @param message ReplicaSelection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.v1.DirectedReadOptions.IReplicaSelection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReplicaSelection message, length delimited. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.ReplicaSelection.verify|verify} messages. + * @param message ReplicaSelection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.v1.DirectedReadOptions.IReplicaSelection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReplicaSelection message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplicaSelection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.v1.DirectedReadOptions.ReplicaSelection; + + /** + * Decodes a ReplicaSelection message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplicaSelection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.v1.DirectedReadOptions.ReplicaSelection; + + /** + * Verifies a ReplicaSelection message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReplicaSelection message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplicaSelection + */ + public static fromObject(object: { [k: string]: any }): google.spanner.v1.DirectedReadOptions.ReplicaSelection; + + /** + * Creates a plain object from a ReplicaSelection message. Also converts values to other types if specified. + * @param message ReplicaSelection + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.v1.DirectedReadOptions.ReplicaSelection, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReplicaSelection to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplicaSelection + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ReplicaSelection { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + READ_WRITE = 1, + READ_ONLY = 2 + } + } + + /** Properties of an IncludeReplicas. */ + interface IIncludeReplicas { + + /** IncludeReplicas replicaSelections */ + replicaSelections?: (google.spanner.v1.DirectedReadOptions.IReplicaSelection[]|null); + + /** IncludeReplicas autoFailoverDisabled */ + autoFailoverDisabled?: (boolean|null); + } + + /** Represents an IncludeReplicas. */ + class IncludeReplicas implements IIncludeReplicas { + + /** + * Constructs a new IncludeReplicas. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.v1.DirectedReadOptions.IIncludeReplicas); + + /** IncludeReplicas replicaSelections. */ + public replicaSelections: google.spanner.v1.DirectedReadOptions.IReplicaSelection[]; + + /** IncludeReplicas autoFailoverDisabled. */ + public autoFailoverDisabled: boolean; + + /** + * Creates a new IncludeReplicas instance using the specified properties. + * @param [properties] Properties to set + * @returns IncludeReplicas instance + */ + public static create(properties?: google.spanner.v1.DirectedReadOptions.IIncludeReplicas): google.spanner.v1.DirectedReadOptions.IncludeReplicas; + + /** + * Encodes the specified IncludeReplicas message. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.IncludeReplicas.verify|verify} messages. + * @param message IncludeReplicas message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.v1.DirectedReadOptions.IIncludeReplicas, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IncludeReplicas message, length delimited. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.IncludeReplicas.verify|verify} messages. + * @param message IncludeReplicas message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.v1.DirectedReadOptions.IIncludeReplicas, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IncludeReplicas message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IncludeReplicas + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.v1.DirectedReadOptions.IncludeReplicas; + + /** + * Decodes an IncludeReplicas message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IncludeReplicas + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.v1.DirectedReadOptions.IncludeReplicas; + + /** + * Verifies an IncludeReplicas message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IncludeReplicas message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IncludeReplicas + */ + public static fromObject(object: { [k: string]: any }): google.spanner.v1.DirectedReadOptions.IncludeReplicas; + + /** + * Creates a plain object from an IncludeReplicas message. Also converts values to other types if specified. + * @param message IncludeReplicas + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.v1.DirectedReadOptions.IncludeReplicas, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IncludeReplicas to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IncludeReplicas + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExcludeReplicas. */ + interface IExcludeReplicas { + + /** ExcludeReplicas replicaSelections */ + replicaSelections?: (google.spanner.v1.DirectedReadOptions.IReplicaSelection[]|null); + } + + /** Represents an ExcludeReplicas. */ + class ExcludeReplicas implements IExcludeReplicas { + + /** + * Constructs a new ExcludeReplicas. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.v1.DirectedReadOptions.IExcludeReplicas); + + /** ExcludeReplicas replicaSelections. */ + public replicaSelections: google.spanner.v1.DirectedReadOptions.IReplicaSelection[]; + + /** + * Creates a new ExcludeReplicas instance using the specified properties. + * @param [properties] Properties to set + * @returns ExcludeReplicas instance + */ + public static create(properties?: google.spanner.v1.DirectedReadOptions.IExcludeReplicas): google.spanner.v1.DirectedReadOptions.ExcludeReplicas; + + /** + * Encodes the specified ExcludeReplicas message. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.ExcludeReplicas.verify|verify} messages. + * @param message ExcludeReplicas message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.v1.DirectedReadOptions.IExcludeReplicas, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExcludeReplicas message, length delimited. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.ExcludeReplicas.verify|verify} messages. + * @param message ExcludeReplicas message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.v1.DirectedReadOptions.IExcludeReplicas, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExcludeReplicas message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExcludeReplicas + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.v1.DirectedReadOptions.ExcludeReplicas; + + /** + * Decodes an ExcludeReplicas message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExcludeReplicas + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.v1.DirectedReadOptions.ExcludeReplicas; + + /** + * Verifies an ExcludeReplicas message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExcludeReplicas message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExcludeReplicas + */ + public static fromObject(object: { [k: string]: any }): google.spanner.v1.DirectedReadOptions.ExcludeReplicas; + + /** + * Creates a plain object from an ExcludeReplicas message. Also converts values to other types if specified. + * @param message ExcludeReplicas + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.v1.DirectedReadOptions.ExcludeReplicas, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExcludeReplicas to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExcludeReplicas + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of an ExecuteSqlRequest. */ interface IExecuteSqlRequest { @@ -18660,6 +19083,9 @@ export namespace google { /** ExecuteSqlRequest requestOptions */ requestOptions?: (google.spanner.v1.IRequestOptions|null); + /** ExecuteSqlRequest directedReadOptions */ + directedReadOptions?: (google.spanner.v1.IDirectedReadOptions|null); + /** ExecuteSqlRequest dataBoostEnabled */ dataBoostEnabled?: (boolean|null); } @@ -18706,6 +19132,9 @@ export namespace google { /** ExecuteSqlRequest requestOptions. */ public requestOptions?: (google.spanner.v1.IRequestOptions|null); + /** ExecuteSqlRequest directedReadOptions. */ + public directedReadOptions?: (google.spanner.v1.IDirectedReadOptions|null); + /** ExecuteSqlRequest dataBoostEnabled. */ public dataBoostEnabled: boolean; @@ -19832,6 +20261,9 @@ export namespace google { /** ReadRequest requestOptions */ requestOptions?: (google.spanner.v1.IRequestOptions|null); + /** ReadRequest directedReadOptions */ + directedReadOptions?: (google.spanner.v1.IDirectedReadOptions|null); + /** ReadRequest dataBoostEnabled */ dataBoostEnabled?: (boolean|null); } @@ -19875,6 +20307,9 @@ export namespace google { /** ReadRequest requestOptions. */ public requestOptions?: (google.spanner.v1.IRequestOptions|null); + /** ReadRequest directedReadOptions. */ + public directedReadOptions?: (google.spanner.v1.IDirectedReadOptions|null); + /** ReadRequest dataBoostEnabled. */ public dataBoostEnabled: boolean; diff --git a/protos/protos.js b/protos/protos.js index cc7cbd78f..b2ec5546f 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -42944,6 +42944,7 @@ case 0: case 2: case 3: + case 4: break; } return null; @@ -43046,6 +43047,10 @@ case 3: message.typeAnnotation = 3; break; + case "PG_OID": + case 4: + message.typeAnnotation = 4; + break; } return message; }; @@ -43606,12 +43611,14 @@ * @property {number} TYPE_ANNOTATION_CODE_UNSPECIFIED=0 TYPE_ANNOTATION_CODE_UNSPECIFIED value * @property {number} PG_NUMERIC=2 PG_NUMERIC value * @property {number} PG_JSONB=3 PG_JSONB value + * @property {number} PG_OID=4 PG_OID value */ v1.TypeAnnotationCode = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "TYPE_ANNOTATION_CODE_UNSPECIFIED"] = 0; values[valuesById[2] = "PG_NUMERIC"] = 2; values[valuesById[3] = "PG_JSONB"] = 3; + values[valuesById[4] = "PG_OID"] = 4; return values; })(); @@ -46455,36 +46462,25 @@ return RequestOptions; })(); - v1.ExecuteSqlRequest = (function() { + v1.DirectedReadOptions = (function() { /** - * Properties of an ExecuteSqlRequest. + * Properties of a DirectedReadOptions. * @memberof google.spanner.v1 - * @interface IExecuteSqlRequest - * @property {string|null} [session] ExecuteSqlRequest session - * @property {google.spanner.v1.ITransactionSelector|null} [transaction] ExecuteSqlRequest transaction - * @property {string|null} [sql] ExecuteSqlRequest sql - * @property {google.protobuf.IStruct|null} [params] ExecuteSqlRequest params - * @property {Object.|null} [paramTypes] ExecuteSqlRequest paramTypes - * @property {Uint8Array|null} [resumeToken] ExecuteSqlRequest resumeToken - * @property {google.spanner.v1.ExecuteSqlRequest.QueryMode|null} [queryMode] ExecuteSqlRequest queryMode - * @property {Uint8Array|null} [partitionToken] ExecuteSqlRequest partitionToken - * @property {number|Long|null} [seqno] ExecuteSqlRequest seqno - * @property {google.spanner.v1.ExecuteSqlRequest.IQueryOptions|null} [queryOptions] ExecuteSqlRequest queryOptions - * @property {google.spanner.v1.IRequestOptions|null} [requestOptions] ExecuteSqlRequest requestOptions - * @property {boolean|null} [dataBoostEnabled] ExecuteSqlRequest dataBoostEnabled + * @interface IDirectedReadOptions + * @property {google.spanner.v1.DirectedReadOptions.IIncludeReplicas|null} [includeReplicas] DirectedReadOptions includeReplicas + * @property {google.spanner.v1.DirectedReadOptions.IExcludeReplicas|null} [excludeReplicas] DirectedReadOptions excludeReplicas */ /** - * Constructs a new ExecuteSqlRequest. + * Constructs a new DirectedReadOptions. * @memberof google.spanner.v1 - * @classdesc Represents an ExecuteSqlRequest. - * @implements IExecuteSqlRequest + * @classdesc Represents a DirectedReadOptions. + * @implements IDirectedReadOptions * @constructor - * @param {google.spanner.v1.IExecuteSqlRequest=} [properties] Properties to set + * @param {google.spanner.v1.IDirectedReadOptions=} [properties] Properties to set */ - function ExecuteSqlRequest(properties) { - this.paramTypes = {}; + function DirectedReadOptions(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46492,251 +46488,103 @@ } /** - * ExecuteSqlRequest session. - * @member {string} session - * @memberof google.spanner.v1.ExecuteSqlRequest - * @instance - */ - ExecuteSqlRequest.prototype.session = ""; - - /** - * ExecuteSqlRequest transaction. - * @member {google.spanner.v1.ITransactionSelector|null|undefined} transaction - * @memberof google.spanner.v1.ExecuteSqlRequest - * @instance - */ - ExecuteSqlRequest.prototype.transaction = null; - - /** - * ExecuteSqlRequest sql. - * @member {string} sql - * @memberof google.spanner.v1.ExecuteSqlRequest - * @instance - */ - ExecuteSqlRequest.prototype.sql = ""; - - /** - * ExecuteSqlRequest params. - * @member {google.protobuf.IStruct|null|undefined} params - * @memberof google.spanner.v1.ExecuteSqlRequest - * @instance - */ - ExecuteSqlRequest.prototype.params = null; - - /** - * ExecuteSqlRequest paramTypes. - * @member {Object.} paramTypes - * @memberof google.spanner.v1.ExecuteSqlRequest - * @instance - */ - ExecuteSqlRequest.prototype.paramTypes = $util.emptyObject; - - /** - * ExecuteSqlRequest resumeToken. - * @member {Uint8Array} resumeToken - * @memberof google.spanner.v1.ExecuteSqlRequest - * @instance - */ - ExecuteSqlRequest.prototype.resumeToken = $util.newBuffer([]); - - /** - * ExecuteSqlRequest queryMode. - * @member {google.spanner.v1.ExecuteSqlRequest.QueryMode} queryMode - * @memberof google.spanner.v1.ExecuteSqlRequest - * @instance - */ - ExecuteSqlRequest.prototype.queryMode = 0; - - /** - * ExecuteSqlRequest partitionToken. - * @member {Uint8Array} partitionToken - * @memberof google.spanner.v1.ExecuteSqlRequest - * @instance - */ - ExecuteSqlRequest.prototype.partitionToken = $util.newBuffer([]); - - /** - * ExecuteSqlRequest seqno. - * @member {number|Long} seqno - * @memberof google.spanner.v1.ExecuteSqlRequest + * DirectedReadOptions includeReplicas. + * @member {google.spanner.v1.DirectedReadOptions.IIncludeReplicas|null|undefined} includeReplicas + * @memberof google.spanner.v1.DirectedReadOptions * @instance */ - ExecuteSqlRequest.prototype.seqno = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + DirectedReadOptions.prototype.includeReplicas = null; /** - * ExecuteSqlRequest queryOptions. - * @member {google.spanner.v1.ExecuteSqlRequest.IQueryOptions|null|undefined} queryOptions - * @memberof google.spanner.v1.ExecuteSqlRequest + * DirectedReadOptions excludeReplicas. + * @member {google.spanner.v1.DirectedReadOptions.IExcludeReplicas|null|undefined} excludeReplicas + * @memberof google.spanner.v1.DirectedReadOptions * @instance */ - ExecuteSqlRequest.prototype.queryOptions = null; + DirectedReadOptions.prototype.excludeReplicas = null; - /** - * ExecuteSqlRequest requestOptions. - * @member {google.spanner.v1.IRequestOptions|null|undefined} requestOptions - * @memberof google.spanner.v1.ExecuteSqlRequest - * @instance - */ - ExecuteSqlRequest.prototype.requestOptions = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ExecuteSqlRequest dataBoostEnabled. - * @member {boolean} dataBoostEnabled - * @memberof google.spanner.v1.ExecuteSqlRequest + * DirectedReadOptions replicas. + * @member {"includeReplicas"|"excludeReplicas"|undefined} replicas + * @memberof google.spanner.v1.DirectedReadOptions * @instance */ - ExecuteSqlRequest.prototype.dataBoostEnabled = false; + Object.defineProperty(DirectedReadOptions.prototype, "replicas", { + get: $util.oneOfGetter($oneOfFields = ["includeReplicas", "excludeReplicas"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ExecuteSqlRequest instance using the specified properties. + * Creates a new DirectedReadOptions instance using the specified properties. * @function create - * @memberof google.spanner.v1.ExecuteSqlRequest + * @memberof google.spanner.v1.DirectedReadOptions * @static - * @param {google.spanner.v1.IExecuteSqlRequest=} [properties] Properties to set - * @returns {google.spanner.v1.ExecuteSqlRequest} ExecuteSqlRequest instance + * @param {google.spanner.v1.IDirectedReadOptions=} [properties] Properties to set + * @returns {google.spanner.v1.DirectedReadOptions} DirectedReadOptions instance */ - ExecuteSqlRequest.create = function create(properties) { - return new ExecuteSqlRequest(properties); + DirectedReadOptions.create = function create(properties) { + return new DirectedReadOptions(properties); }; /** - * Encodes the specified ExecuteSqlRequest message. Does not implicitly {@link google.spanner.v1.ExecuteSqlRequest.verify|verify} messages. + * Encodes the specified DirectedReadOptions message. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.verify|verify} messages. * @function encode - * @memberof google.spanner.v1.ExecuteSqlRequest + * @memberof google.spanner.v1.DirectedReadOptions * @static - * @param {google.spanner.v1.IExecuteSqlRequest} message ExecuteSqlRequest message or plain object to encode + * @param {google.spanner.v1.IDirectedReadOptions} message DirectedReadOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExecuteSqlRequest.encode = function encode(message, writer) { + DirectedReadOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.session != null && Object.hasOwnProperty.call(message, "session")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); - if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) - $root.google.spanner.v1.TransactionSelector.encode(message.transaction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.sql != null && Object.hasOwnProperty.call(message, "sql")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.sql); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.google.protobuf.Struct.encode(message.params, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.paramTypes != null && Object.hasOwnProperty.call(message, "paramTypes")) - for (var keys = Object.keys(message.paramTypes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.spanner.v1.Type.encode(message.paramTypes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.resumeToken); - if (message.queryMode != null && Object.hasOwnProperty.call(message, "queryMode")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.queryMode); - if (message.partitionToken != null && Object.hasOwnProperty.call(message, "partitionToken")) - writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.partitionToken); - if (message.seqno != null && Object.hasOwnProperty.call(message, "seqno")) - writer.uint32(/* id 9, wireType 0 =*/72).int64(message.seqno); - if (message.queryOptions != null && Object.hasOwnProperty.call(message, "queryOptions")) - $root.google.spanner.v1.ExecuteSqlRequest.QueryOptions.encode(message.queryOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.requestOptions != null && Object.hasOwnProperty.call(message, "requestOptions")) - $root.google.spanner.v1.RequestOptions.encode(message.requestOptions, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.dataBoostEnabled != null && Object.hasOwnProperty.call(message, "dataBoostEnabled")) - writer.uint32(/* id 16, wireType 0 =*/128).bool(message.dataBoostEnabled); + if (message.includeReplicas != null && Object.hasOwnProperty.call(message, "includeReplicas")) + $root.google.spanner.v1.DirectedReadOptions.IncludeReplicas.encode(message.includeReplicas, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.excludeReplicas != null && Object.hasOwnProperty.call(message, "excludeReplicas")) + $root.google.spanner.v1.DirectedReadOptions.ExcludeReplicas.encode(message.excludeReplicas, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ExecuteSqlRequest message, length delimited. Does not implicitly {@link google.spanner.v1.ExecuteSqlRequest.verify|verify} messages. + * Encodes the specified DirectedReadOptions message, length delimited. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.spanner.v1.ExecuteSqlRequest + * @memberof google.spanner.v1.DirectedReadOptions * @static - * @param {google.spanner.v1.IExecuteSqlRequest} message ExecuteSqlRequest message or plain object to encode + * @param {google.spanner.v1.IDirectedReadOptions} message DirectedReadOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExecuteSqlRequest.encodeDelimited = function encodeDelimited(message, writer) { + DirectedReadOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExecuteSqlRequest message from the specified reader or buffer. + * Decodes a DirectedReadOptions message from the specified reader or buffer. * @function decode - * @memberof google.spanner.v1.ExecuteSqlRequest + * @memberof google.spanner.v1.DirectedReadOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.spanner.v1.ExecuteSqlRequest} ExecuteSqlRequest + * @returns {google.spanner.v1.DirectedReadOptions} DirectedReadOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExecuteSqlRequest.decode = function decode(reader, length) { + DirectedReadOptions.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.v1.ExecuteSqlRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.v1.DirectedReadOptions(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.session = reader.string(); + message.includeReplicas = $root.google.spanner.v1.DirectedReadOptions.IncludeReplicas.decode(reader, reader.uint32()); break; } case 2: { - message.transaction = $root.google.spanner.v1.TransactionSelector.decode(reader, reader.uint32()); - break; - } - case 3: { - message.sql = reader.string(); - break; - } - case 4: { - message.params = $root.google.protobuf.Struct.decode(reader, reader.uint32()); - break; - } - case 5: { - if (message.paramTypes === $util.emptyObject) - message.paramTypes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.spanner.v1.Type.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.paramTypes[key] = value; - break; - } - case 6: { - message.resumeToken = reader.bytes(); - break; - } - case 7: { - message.queryMode = reader.int32(); - break; - } - case 8: { - message.partitionToken = reader.bytes(); - break; - } - case 9: { - message.seqno = reader.int64(); - break; - } - case 10: { - message.queryOptions = $root.google.spanner.v1.ExecuteSqlRequest.QueryOptions.decode(reader, reader.uint32()); - break; - } - case 11: { - message.requestOptions = $root.google.spanner.v1.RequestOptions.decode(reader, reader.uint32()); - break; - } - case 16: { - message.dataBoostEnabled = reader.bool(); + message.excludeReplicas = $root.google.spanner.v1.DirectedReadOptions.ExcludeReplicas.decode(reader, reader.uint32()); break; } default: @@ -46748,62 +46596,1237 @@ }; /** - * Decodes an ExecuteSqlRequest message from the specified reader or buffer, length delimited. + * Decodes a DirectedReadOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.spanner.v1.ExecuteSqlRequest + * @memberof google.spanner.v1.DirectedReadOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.spanner.v1.ExecuteSqlRequest} ExecuteSqlRequest + * @returns {google.spanner.v1.DirectedReadOptions} DirectedReadOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExecuteSqlRequest.decodeDelimited = function decodeDelimited(reader) { + DirectedReadOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExecuteSqlRequest message. + * Verifies a DirectedReadOptions message. * @function verify - * @memberof google.spanner.v1.ExecuteSqlRequest + * @memberof google.spanner.v1.DirectedReadOptions * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExecuteSqlRequest.verify = function verify(message) { + DirectedReadOptions.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.session != null && message.hasOwnProperty("session")) - if (!$util.isString(message.session)) - return "session: string expected"; - if (message.transaction != null && message.hasOwnProperty("transaction")) { - var error = $root.google.spanner.v1.TransactionSelector.verify(message.transaction); - if (error) - return "transaction." + error; - } - if (message.sql != null && message.hasOwnProperty("sql")) - if (!$util.isString(message.sql)) - return "sql: string expected"; - if (message.params != null && message.hasOwnProperty("params")) { - var error = $root.google.protobuf.Struct.verify(message.params); - if (error) - return "params." + error; + var properties = {}; + if (message.includeReplicas != null && message.hasOwnProperty("includeReplicas")) { + properties.replicas = 1; + { + var error = $root.google.spanner.v1.DirectedReadOptions.IncludeReplicas.verify(message.includeReplicas); + if (error) + return "includeReplicas." + error; + } } - if (message.paramTypes != null && message.hasOwnProperty("paramTypes")) { - if (!$util.isObject(message.paramTypes)) - return "paramTypes: object expected"; - var key = Object.keys(message.paramTypes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.spanner.v1.Type.verify(message.paramTypes[key[i]]); + if (message.excludeReplicas != null && message.hasOwnProperty("excludeReplicas")) { + if (properties.replicas === 1) + return "replicas: multiple values"; + properties.replicas = 1; + { + var error = $root.google.spanner.v1.DirectedReadOptions.ExcludeReplicas.verify(message.excludeReplicas); if (error) - return "paramTypes." + error; + return "excludeReplicas." + error; } } - if (message.resumeToken != null && message.hasOwnProperty("resumeToken")) - if (!(message.resumeToken && typeof message.resumeToken.length === "number" || $util.isString(message.resumeToken))) - return "resumeToken: buffer expected"; - if (message.queryMode != null && message.hasOwnProperty("queryMode")) + return null; + }; + + /** + * Creates a DirectedReadOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.v1.DirectedReadOptions + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.v1.DirectedReadOptions} DirectedReadOptions + */ + DirectedReadOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.v1.DirectedReadOptions) + return object; + var message = new $root.google.spanner.v1.DirectedReadOptions(); + if (object.includeReplicas != null) { + if (typeof object.includeReplicas !== "object") + throw TypeError(".google.spanner.v1.DirectedReadOptions.includeReplicas: object expected"); + message.includeReplicas = $root.google.spanner.v1.DirectedReadOptions.IncludeReplicas.fromObject(object.includeReplicas); + } + if (object.excludeReplicas != null) { + if (typeof object.excludeReplicas !== "object") + throw TypeError(".google.spanner.v1.DirectedReadOptions.excludeReplicas: object expected"); + message.excludeReplicas = $root.google.spanner.v1.DirectedReadOptions.ExcludeReplicas.fromObject(object.excludeReplicas); + } + return message; + }; + + /** + * Creates a plain object from a DirectedReadOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.v1.DirectedReadOptions + * @static + * @param {google.spanner.v1.DirectedReadOptions} message DirectedReadOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DirectedReadOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.includeReplicas != null && message.hasOwnProperty("includeReplicas")) { + object.includeReplicas = $root.google.spanner.v1.DirectedReadOptions.IncludeReplicas.toObject(message.includeReplicas, options); + if (options.oneofs) + object.replicas = "includeReplicas"; + } + if (message.excludeReplicas != null && message.hasOwnProperty("excludeReplicas")) { + object.excludeReplicas = $root.google.spanner.v1.DirectedReadOptions.ExcludeReplicas.toObject(message.excludeReplicas, options); + if (options.oneofs) + object.replicas = "excludeReplicas"; + } + return object; + }; + + /** + * Converts this DirectedReadOptions to JSON. + * @function toJSON + * @memberof google.spanner.v1.DirectedReadOptions + * @instance + * @returns {Object.} JSON object + */ + DirectedReadOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DirectedReadOptions + * @function getTypeUrl + * @memberof google.spanner.v1.DirectedReadOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DirectedReadOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.v1.DirectedReadOptions"; + }; + + DirectedReadOptions.ReplicaSelection = (function() { + + /** + * Properties of a ReplicaSelection. + * @memberof google.spanner.v1.DirectedReadOptions + * @interface IReplicaSelection + * @property {string|null} [location] ReplicaSelection location + * @property {google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type|null} [type] ReplicaSelection type + */ + + /** + * Constructs a new ReplicaSelection. + * @memberof google.spanner.v1.DirectedReadOptions + * @classdesc Represents a ReplicaSelection. + * @implements IReplicaSelection + * @constructor + * @param {google.spanner.v1.DirectedReadOptions.IReplicaSelection=} [properties] Properties to set + */ + function ReplicaSelection(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplicaSelection location. + * @member {string} location + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @instance + */ + ReplicaSelection.prototype.location = ""; + + /** + * ReplicaSelection type. + * @member {google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type} type + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @instance + */ + ReplicaSelection.prototype.type = 0; + + /** + * Creates a new ReplicaSelection instance using the specified properties. + * @function create + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @static + * @param {google.spanner.v1.DirectedReadOptions.IReplicaSelection=} [properties] Properties to set + * @returns {google.spanner.v1.DirectedReadOptions.ReplicaSelection} ReplicaSelection instance + */ + ReplicaSelection.create = function create(properties) { + return new ReplicaSelection(properties); + }; + + /** + * Encodes the specified ReplicaSelection message. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.ReplicaSelection.verify|verify} messages. + * @function encode + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @static + * @param {google.spanner.v1.DirectedReadOptions.IReplicaSelection} message ReplicaSelection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicaSelection.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.location); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + return writer; + }; + + /** + * Encodes the specified ReplicaSelection message, length delimited. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.ReplicaSelection.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @static + * @param {google.spanner.v1.DirectedReadOptions.IReplicaSelection} message ReplicaSelection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicaSelection.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplicaSelection message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.v1.DirectedReadOptions.ReplicaSelection} ReplicaSelection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicaSelection.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.location = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplicaSelection message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.v1.DirectedReadOptions.ReplicaSelection} ReplicaSelection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicaSelection.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplicaSelection message. + * @function verify + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplicaSelection.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a ReplicaSelection message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.v1.DirectedReadOptions.ReplicaSelection} ReplicaSelection + */ + ReplicaSelection.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection) + return object; + var message = new $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection(); + if (object.location != null) + message.location = String(object.location); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "READ_WRITE": + case 1: + message.type = 1; + break; + case "READ_ONLY": + case 2: + message.type = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a ReplicaSelection message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @static + * @param {google.spanner.v1.DirectedReadOptions.ReplicaSelection} message ReplicaSelection + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplicaSelection.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.location = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + } + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type[message.type] === undefined ? message.type : $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this ReplicaSelection to JSON. + * @function toJSON + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @instance + * @returns {Object.} JSON object + */ + ReplicaSelection.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReplicaSelection + * @function getTypeUrl + * @memberof google.spanner.v1.DirectedReadOptions.ReplicaSelection + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplicaSelection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.v1.DirectedReadOptions.ReplicaSelection"; + }; + + /** + * Type enum. + * @name google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} READ_WRITE=1 READ_WRITE value + * @property {number} READ_ONLY=2 READ_ONLY value + */ + ReplicaSelection.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "READ_WRITE"] = 1; + values[valuesById[2] = "READ_ONLY"] = 2; + return values; + })(); + + return ReplicaSelection; + })(); + + DirectedReadOptions.IncludeReplicas = (function() { + + /** + * Properties of an IncludeReplicas. + * @memberof google.spanner.v1.DirectedReadOptions + * @interface IIncludeReplicas + * @property {Array.|null} [replicaSelections] IncludeReplicas replicaSelections + * @property {boolean|null} [autoFailoverDisabled] IncludeReplicas autoFailoverDisabled + */ + + /** + * Constructs a new IncludeReplicas. + * @memberof google.spanner.v1.DirectedReadOptions + * @classdesc Represents an IncludeReplicas. + * @implements IIncludeReplicas + * @constructor + * @param {google.spanner.v1.DirectedReadOptions.IIncludeReplicas=} [properties] Properties to set + */ + function IncludeReplicas(properties) { + this.replicaSelections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IncludeReplicas replicaSelections. + * @member {Array.} replicaSelections + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @instance + */ + IncludeReplicas.prototype.replicaSelections = $util.emptyArray; + + /** + * IncludeReplicas autoFailoverDisabled. + * @member {boolean} autoFailoverDisabled + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @instance + */ + IncludeReplicas.prototype.autoFailoverDisabled = false; + + /** + * Creates a new IncludeReplicas instance using the specified properties. + * @function create + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @static + * @param {google.spanner.v1.DirectedReadOptions.IIncludeReplicas=} [properties] Properties to set + * @returns {google.spanner.v1.DirectedReadOptions.IncludeReplicas} IncludeReplicas instance + */ + IncludeReplicas.create = function create(properties) { + return new IncludeReplicas(properties); + }; + + /** + * Encodes the specified IncludeReplicas message. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.IncludeReplicas.verify|verify} messages. + * @function encode + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @static + * @param {google.spanner.v1.DirectedReadOptions.IIncludeReplicas} message IncludeReplicas message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IncludeReplicas.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.replicaSelections != null && message.replicaSelections.length) + for (var i = 0; i < message.replicaSelections.length; ++i) + $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.encode(message.replicaSelections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.autoFailoverDisabled != null && Object.hasOwnProperty.call(message, "autoFailoverDisabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.autoFailoverDisabled); + return writer; + }; + + /** + * Encodes the specified IncludeReplicas message, length delimited. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.IncludeReplicas.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @static + * @param {google.spanner.v1.DirectedReadOptions.IIncludeReplicas} message IncludeReplicas message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IncludeReplicas.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IncludeReplicas message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.v1.DirectedReadOptions.IncludeReplicas} IncludeReplicas + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IncludeReplicas.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.v1.DirectedReadOptions.IncludeReplicas(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.replicaSelections && message.replicaSelections.length)) + message.replicaSelections = []; + message.replicaSelections.push($root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.decode(reader, reader.uint32())); + break; + } + case 2: { + message.autoFailoverDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IncludeReplicas message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.v1.DirectedReadOptions.IncludeReplicas} IncludeReplicas + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IncludeReplicas.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IncludeReplicas message. + * @function verify + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IncludeReplicas.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.replicaSelections != null && message.hasOwnProperty("replicaSelections")) { + if (!Array.isArray(message.replicaSelections)) + return "replicaSelections: array expected"; + for (var i = 0; i < message.replicaSelections.length; ++i) { + var error = $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.verify(message.replicaSelections[i]); + if (error) + return "replicaSelections." + error; + } + } + if (message.autoFailoverDisabled != null && message.hasOwnProperty("autoFailoverDisabled")) + if (typeof message.autoFailoverDisabled !== "boolean") + return "autoFailoverDisabled: boolean expected"; + return null; + }; + + /** + * Creates an IncludeReplicas message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.v1.DirectedReadOptions.IncludeReplicas} IncludeReplicas + */ + IncludeReplicas.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.v1.DirectedReadOptions.IncludeReplicas) + return object; + var message = new $root.google.spanner.v1.DirectedReadOptions.IncludeReplicas(); + if (object.replicaSelections) { + if (!Array.isArray(object.replicaSelections)) + throw TypeError(".google.spanner.v1.DirectedReadOptions.IncludeReplicas.replicaSelections: array expected"); + message.replicaSelections = []; + for (var i = 0; i < object.replicaSelections.length; ++i) { + if (typeof object.replicaSelections[i] !== "object") + throw TypeError(".google.spanner.v1.DirectedReadOptions.IncludeReplicas.replicaSelections: object expected"); + message.replicaSelections[i] = $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.fromObject(object.replicaSelections[i]); + } + } + if (object.autoFailoverDisabled != null) + message.autoFailoverDisabled = Boolean(object.autoFailoverDisabled); + return message; + }; + + /** + * Creates a plain object from an IncludeReplicas message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @static + * @param {google.spanner.v1.DirectedReadOptions.IncludeReplicas} message IncludeReplicas + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IncludeReplicas.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.replicaSelections = []; + if (options.defaults) + object.autoFailoverDisabled = false; + if (message.replicaSelections && message.replicaSelections.length) { + object.replicaSelections = []; + for (var j = 0; j < message.replicaSelections.length; ++j) + object.replicaSelections[j] = $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.toObject(message.replicaSelections[j], options); + } + if (message.autoFailoverDisabled != null && message.hasOwnProperty("autoFailoverDisabled")) + object.autoFailoverDisabled = message.autoFailoverDisabled; + return object; + }; + + /** + * Converts this IncludeReplicas to JSON. + * @function toJSON + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @instance + * @returns {Object.} JSON object + */ + IncludeReplicas.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IncludeReplicas + * @function getTypeUrl + * @memberof google.spanner.v1.DirectedReadOptions.IncludeReplicas + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IncludeReplicas.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.v1.DirectedReadOptions.IncludeReplicas"; + }; + + return IncludeReplicas; + })(); + + DirectedReadOptions.ExcludeReplicas = (function() { + + /** + * Properties of an ExcludeReplicas. + * @memberof google.spanner.v1.DirectedReadOptions + * @interface IExcludeReplicas + * @property {Array.|null} [replicaSelections] ExcludeReplicas replicaSelections + */ + + /** + * Constructs a new ExcludeReplicas. + * @memberof google.spanner.v1.DirectedReadOptions + * @classdesc Represents an ExcludeReplicas. + * @implements IExcludeReplicas + * @constructor + * @param {google.spanner.v1.DirectedReadOptions.IExcludeReplicas=} [properties] Properties to set + */ + function ExcludeReplicas(properties) { + this.replicaSelections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExcludeReplicas replicaSelections. + * @member {Array.} replicaSelections + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @instance + */ + ExcludeReplicas.prototype.replicaSelections = $util.emptyArray; + + /** + * Creates a new ExcludeReplicas instance using the specified properties. + * @function create + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @static + * @param {google.spanner.v1.DirectedReadOptions.IExcludeReplicas=} [properties] Properties to set + * @returns {google.spanner.v1.DirectedReadOptions.ExcludeReplicas} ExcludeReplicas instance + */ + ExcludeReplicas.create = function create(properties) { + return new ExcludeReplicas(properties); + }; + + /** + * Encodes the specified ExcludeReplicas message. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.ExcludeReplicas.verify|verify} messages. + * @function encode + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @static + * @param {google.spanner.v1.DirectedReadOptions.IExcludeReplicas} message ExcludeReplicas message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExcludeReplicas.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.replicaSelections != null && message.replicaSelections.length) + for (var i = 0; i < message.replicaSelections.length; ++i) + $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.encode(message.replicaSelections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExcludeReplicas message, length delimited. Does not implicitly {@link google.spanner.v1.DirectedReadOptions.ExcludeReplicas.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @static + * @param {google.spanner.v1.DirectedReadOptions.IExcludeReplicas} message ExcludeReplicas message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExcludeReplicas.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExcludeReplicas message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.v1.DirectedReadOptions.ExcludeReplicas} ExcludeReplicas + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExcludeReplicas.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.v1.DirectedReadOptions.ExcludeReplicas(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.replicaSelections && message.replicaSelections.length)) + message.replicaSelections = []; + message.replicaSelections.push($root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExcludeReplicas message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.v1.DirectedReadOptions.ExcludeReplicas} ExcludeReplicas + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExcludeReplicas.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExcludeReplicas message. + * @function verify + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExcludeReplicas.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.replicaSelections != null && message.hasOwnProperty("replicaSelections")) { + if (!Array.isArray(message.replicaSelections)) + return "replicaSelections: array expected"; + for (var i = 0; i < message.replicaSelections.length; ++i) { + var error = $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.verify(message.replicaSelections[i]); + if (error) + return "replicaSelections." + error; + } + } + return null; + }; + + /** + * Creates an ExcludeReplicas message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.v1.DirectedReadOptions.ExcludeReplicas} ExcludeReplicas + */ + ExcludeReplicas.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.v1.DirectedReadOptions.ExcludeReplicas) + return object; + var message = new $root.google.spanner.v1.DirectedReadOptions.ExcludeReplicas(); + if (object.replicaSelections) { + if (!Array.isArray(object.replicaSelections)) + throw TypeError(".google.spanner.v1.DirectedReadOptions.ExcludeReplicas.replicaSelections: array expected"); + message.replicaSelections = []; + for (var i = 0; i < object.replicaSelections.length; ++i) { + if (typeof object.replicaSelections[i] !== "object") + throw TypeError(".google.spanner.v1.DirectedReadOptions.ExcludeReplicas.replicaSelections: object expected"); + message.replicaSelections[i] = $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.fromObject(object.replicaSelections[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ExcludeReplicas message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @static + * @param {google.spanner.v1.DirectedReadOptions.ExcludeReplicas} message ExcludeReplicas + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExcludeReplicas.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.replicaSelections = []; + if (message.replicaSelections && message.replicaSelections.length) { + object.replicaSelections = []; + for (var j = 0; j < message.replicaSelections.length; ++j) + object.replicaSelections[j] = $root.google.spanner.v1.DirectedReadOptions.ReplicaSelection.toObject(message.replicaSelections[j], options); + } + return object; + }; + + /** + * Converts this ExcludeReplicas to JSON. + * @function toJSON + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @instance + * @returns {Object.} JSON object + */ + ExcludeReplicas.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExcludeReplicas + * @function getTypeUrl + * @memberof google.spanner.v1.DirectedReadOptions.ExcludeReplicas + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExcludeReplicas.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.v1.DirectedReadOptions.ExcludeReplicas"; + }; + + return ExcludeReplicas; + })(); + + return DirectedReadOptions; + })(); + + v1.ExecuteSqlRequest = (function() { + + /** + * Properties of an ExecuteSqlRequest. + * @memberof google.spanner.v1 + * @interface IExecuteSqlRequest + * @property {string|null} [session] ExecuteSqlRequest session + * @property {google.spanner.v1.ITransactionSelector|null} [transaction] ExecuteSqlRequest transaction + * @property {string|null} [sql] ExecuteSqlRequest sql + * @property {google.protobuf.IStruct|null} [params] ExecuteSqlRequest params + * @property {Object.|null} [paramTypes] ExecuteSqlRequest paramTypes + * @property {Uint8Array|null} [resumeToken] ExecuteSqlRequest resumeToken + * @property {google.spanner.v1.ExecuteSqlRequest.QueryMode|null} [queryMode] ExecuteSqlRequest queryMode + * @property {Uint8Array|null} [partitionToken] ExecuteSqlRequest partitionToken + * @property {number|Long|null} [seqno] ExecuteSqlRequest seqno + * @property {google.spanner.v1.ExecuteSqlRequest.IQueryOptions|null} [queryOptions] ExecuteSqlRequest queryOptions + * @property {google.spanner.v1.IRequestOptions|null} [requestOptions] ExecuteSqlRequest requestOptions + * @property {google.spanner.v1.IDirectedReadOptions|null} [directedReadOptions] ExecuteSqlRequest directedReadOptions + * @property {boolean|null} [dataBoostEnabled] ExecuteSqlRequest dataBoostEnabled + */ + + /** + * Constructs a new ExecuteSqlRequest. + * @memberof google.spanner.v1 + * @classdesc Represents an ExecuteSqlRequest. + * @implements IExecuteSqlRequest + * @constructor + * @param {google.spanner.v1.IExecuteSqlRequest=} [properties] Properties to set + */ + function ExecuteSqlRequest(properties) { + this.paramTypes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExecuteSqlRequest session. + * @member {string} session + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.session = ""; + + /** + * ExecuteSqlRequest transaction. + * @member {google.spanner.v1.ITransactionSelector|null|undefined} transaction + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.transaction = null; + + /** + * ExecuteSqlRequest sql. + * @member {string} sql + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.sql = ""; + + /** + * ExecuteSqlRequest params. + * @member {google.protobuf.IStruct|null|undefined} params + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.params = null; + + /** + * ExecuteSqlRequest paramTypes. + * @member {Object.} paramTypes + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.paramTypes = $util.emptyObject; + + /** + * ExecuteSqlRequest resumeToken. + * @member {Uint8Array} resumeToken + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.resumeToken = $util.newBuffer([]); + + /** + * ExecuteSqlRequest queryMode. + * @member {google.spanner.v1.ExecuteSqlRequest.QueryMode} queryMode + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.queryMode = 0; + + /** + * ExecuteSqlRequest partitionToken. + * @member {Uint8Array} partitionToken + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.partitionToken = $util.newBuffer([]); + + /** + * ExecuteSqlRequest seqno. + * @member {number|Long} seqno + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.seqno = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ExecuteSqlRequest queryOptions. + * @member {google.spanner.v1.ExecuteSqlRequest.IQueryOptions|null|undefined} queryOptions + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.queryOptions = null; + + /** + * ExecuteSqlRequest requestOptions. + * @member {google.spanner.v1.IRequestOptions|null|undefined} requestOptions + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.requestOptions = null; + + /** + * ExecuteSqlRequest directedReadOptions. + * @member {google.spanner.v1.IDirectedReadOptions|null|undefined} directedReadOptions + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.directedReadOptions = null; + + /** + * ExecuteSqlRequest dataBoostEnabled. + * @member {boolean} dataBoostEnabled + * @memberof google.spanner.v1.ExecuteSqlRequest + * @instance + */ + ExecuteSqlRequest.prototype.dataBoostEnabled = false; + + /** + * Creates a new ExecuteSqlRequest instance using the specified properties. + * @function create + * @memberof google.spanner.v1.ExecuteSqlRequest + * @static + * @param {google.spanner.v1.IExecuteSqlRequest=} [properties] Properties to set + * @returns {google.spanner.v1.ExecuteSqlRequest} ExecuteSqlRequest instance + */ + ExecuteSqlRequest.create = function create(properties) { + return new ExecuteSqlRequest(properties); + }; + + /** + * Encodes the specified ExecuteSqlRequest message. Does not implicitly {@link google.spanner.v1.ExecuteSqlRequest.verify|verify} messages. + * @function encode + * @memberof google.spanner.v1.ExecuteSqlRequest + * @static + * @param {google.spanner.v1.IExecuteSqlRequest} message ExecuteSqlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecuteSqlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); + if (message.transaction != null && Object.hasOwnProperty.call(message, "transaction")) + $root.google.spanner.v1.TransactionSelector.encode(message.transaction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.sql != null && Object.hasOwnProperty.call(message, "sql")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sql); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.google.protobuf.Struct.encode(message.params, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.paramTypes != null && Object.hasOwnProperty.call(message, "paramTypes")) + for (var keys = Object.keys(message.paramTypes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.spanner.v1.Type.encode(message.paramTypes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.resumeToken != null && Object.hasOwnProperty.call(message, "resumeToken")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.resumeToken); + if (message.queryMode != null && Object.hasOwnProperty.call(message, "queryMode")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.queryMode); + if (message.partitionToken != null && Object.hasOwnProperty.call(message, "partitionToken")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.partitionToken); + if (message.seqno != null && Object.hasOwnProperty.call(message, "seqno")) + writer.uint32(/* id 9, wireType 0 =*/72).int64(message.seqno); + if (message.queryOptions != null && Object.hasOwnProperty.call(message, "queryOptions")) + $root.google.spanner.v1.ExecuteSqlRequest.QueryOptions.encode(message.queryOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.requestOptions != null && Object.hasOwnProperty.call(message, "requestOptions")) + $root.google.spanner.v1.RequestOptions.encode(message.requestOptions, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.directedReadOptions != null && Object.hasOwnProperty.call(message, "directedReadOptions")) + $root.google.spanner.v1.DirectedReadOptions.encode(message.directedReadOptions, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.dataBoostEnabled != null && Object.hasOwnProperty.call(message, "dataBoostEnabled")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.dataBoostEnabled); + return writer; + }; + + /** + * Encodes the specified ExecuteSqlRequest message, length delimited. Does not implicitly {@link google.spanner.v1.ExecuteSqlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.v1.ExecuteSqlRequest + * @static + * @param {google.spanner.v1.IExecuteSqlRequest} message ExecuteSqlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecuteSqlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExecuteSqlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.v1.ExecuteSqlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.v1.ExecuteSqlRequest} ExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecuteSqlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.v1.ExecuteSqlRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.session = reader.string(); + break; + } + case 2: { + message.transaction = $root.google.spanner.v1.TransactionSelector.decode(reader, reader.uint32()); + break; + } + case 3: { + message.sql = reader.string(); + break; + } + case 4: { + message.params = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 5: { + if (message.paramTypes === $util.emptyObject) + message.paramTypes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.spanner.v1.Type.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.paramTypes[key] = value; + break; + } + case 6: { + message.resumeToken = reader.bytes(); + break; + } + case 7: { + message.queryMode = reader.int32(); + break; + } + case 8: { + message.partitionToken = reader.bytes(); + break; + } + case 9: { + message.seqno = reader.int64(); + break; + } + case 10: { + message.queryOptions = $root.google.spanner.v1.ExecuteSqlRequest.QueryOptions.decode(reader, reader.uint32()); + break; + } + case 11: { + message.requestOptions = $root.google.spanner.v1.RequestOptions.decode(reader, reader.uint32()); + break; + } + case 15: { + message.directedReadOptions = $root.google.spanner.v1.DirectedReadOptions.decode(reader, reader.uint32()); + break; + } + case 16: { + message.dataBoostEnabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExecuteSqlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.v1.ExecuteSqlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.v1.ExecuteSqlRequest} ExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecuteSqlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExecuteSqlRequest message. + * @function verify + * @memberof google.spanner.v1.ExecuteSqlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExecuteSqlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.transaction != null && message.hasOwnProperty("transaction")) { + var error = $root.google.spanner.v1.TransactionSelector.verify(message.transaction); + if (error) + return "transaction." + error; + } + if (message.sql != null && message.hasOwnProperty("sql")) + if (!$util.isString(message.sql)) + return "sql: string expected"; + if (message.params != null && message.hasOwnProperty("params")) { + var error = $root.google.protobuf.Struct.verify(message.params); + if (error) + return "params." + error; + } + if (message.paramTypes != null && message.hasOwnProperty("paramTypes")) { + if (!$util.isObject(message.paramTypes)) + return "paramTypes: object expected"; + var key = Object.keys(message.paramTypes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.spanner.v1.Type.verify(message.paramTypes[key[i]]); + if (error) + return "paramTypes." + error; + } + } + if (message.resumeToken != null && message.hasOwnProperty("resumeToken")) + if (!(message.resumeToken && typeof message.resumeToken.length === "number" || $util.isString(message.resumeToken))) + return "resumeToken: buffer expected"; + if (message.queryMode != null && message.hasOwnProperty("queryMode")) switch (message.queryMode) { default: return "queryMode: enum value expected"; @@ -46828,6 +47851,11 @@ if (error) return "requestOptions." + error; } + if (message.directedReadOptions != null && message.hasOwnProperty("directedReadOptions")) { + var error = $root.google.spanner.v1.DirectedReadOptions.verify(message.directedReadOptions); + if (error) + return "directedReadOptions." + error; + } if (message.dataBoostEnabled != null && message.hasOwnProperty("dataBoostEnabled")) if (typeof message.dataBoostEnabled !== "boolean") return "dataBoostEnabled: boolean expected"; @@ -46919,6 +47947,11 @@ throw TypeError(".google.spanner.v1.ExecuteSqlRequest.requestOptions: object expected"); message.requestOptions = $root.google.spanner.v1.RequestOptions.fromObject(object.requestOptions); } + if (object.directedReadOptions != null) { + if (typeof object.directedReadOptions !== "object") + throw TypeError(".google.spanner.v1.ExecuteSqlRequest.directedReadOptions: object expected"); + message.directedReadOptions = $root.google.spanner.v1.DirectedReadOptions.fromObject(object.directedReadOptions); + } if (object.dataBoostEnabled != null) message.dataBoostEnabled = Boolean(object.dataBoostEnabled); return message; @@ -46966,6 +47999,7 @@ object.seqno = options.longs === String ? "0" : 0; object.queryOptions = null; object.requestOptions = null; + object.directedReadOptions = null; object.dataBoostEnabled = false; } if (message.session != null && message.hasOwnProperty("session")) @@ -46997,6 +48031,8 @@ object.queryOptions = $root.google.spanner.v1.ExecuteSqlRequest.QueryOptions.toObject(message.queryOptions, options); if (message.requestOptions != null && message.hasOwnProperty("requestOptions")) object.requestOptions = $root.google.spanner.v1.RequestOptions.toObject(message.requestOptions, options); + if (message.directedReadOptions != null && message.hasOwnProperty("directedReadOptions")) + object.directedReadOptions = $root.google.spanner.v1.DirectedReadOptions.toObject(message.directedReadOptions, options); if (message.dataBoostEnabled != null && message.hasOwnProperty("dataBoostEnabled")) object.dataBoostEnabled = message.dataBoostEnabled; return object; @@ -49654,6 +50690,7 @@ * @property {Uint8Array|null} [resumeToken] ReadRequest resumeToken * @property {Uint8Array|null} [partitionToken] ReadRequest partitionToken * @property {google.spanner.v1.IRequestOptions|null} [requestOptions] ReadRequest requestOptions + * @property {google.spanner.v1.IDirectedReadOptions|null} [directedReadOptions] ReadRequest directedReadOptions * @property {boolean|null} [dataBoostEnabled] ReadRequest dataBoostEnabled */ @@ -49753,6 +50790,14 @@ */ ReadRequest.prototype.requestOptions = null; + /** + * ReadRequest directedReadOptions. + * @member {google.spanner.v1.IDirectedReadOptions|null|undefined} directedReadOptions + * @memberof google.spanner.v1.ReadRequest + * @instance + */ + ReadRequest.prototype.directedReadOptions = null; + /** * ReadRequest dataBoostEnabled. * @member {boolean} dataBoostEnabled @@ -49806,6 +50851,8 @@ writer.uint32(/* id 10, wireType 2 =*/82).bytes(message.partitionToken); if (message.requestOptions != null && Object.hasOwnProperty.call(message, "requestOptions")) $root.google.spanner.v1.RequestOptions.encode(message.requestOptions, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.directedReadOptions != null && Object.hasOwnProperty.call(message, "directedReadOptions")) + $root.google.spanner.v1.DirectedReadOptions.encode(message.directedReadOptions, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); if (message.dataBoostEnabled != null && Object.hasOwnProperty.call(message, "dataBoostEnabled")) writer.uint32(/* id 15, wireType 0 =*/120).bool(message.dataBoostEnabled); return writer; @@ -49884,6 +50931,10 @@ message.requestOptions = $root.google.spanner.v1.RequestOptions.decode(reader, reader.uint32()); break; } + case 14: { + message.directedReadOptions = $root.google.spanner.v1.DirectedReadOptions.decode(reader, reader.uint32()); + break; + } case 15: { message.dataBoostEnabled = reader.bool(); break; @@ -49963,6 +51014,11 @@ if (error) return "requestOptions." + error; } + if (message.directedReadOptions != null && message.hasOwnProperty("directedReadOptions")) { + var error = $root.google.spanner.v1.DirectedReadOptions.verify(message.directedReadOptions); + if (error) + return "directedReadOptions." + error; + } if (message.dataBoostEnabled != null && message.hasOwnProperty("dataBoostEnabled")) if (typeof message.dataBoostEnabled !== "boolean") return "dataBoostEnabled: boolean expected"; @@ -50028,6 +51084,11 @@ throw TypeError(".google.spanner.v1.ReadRequest.requestOptions: object expected"); message.requestOptions = $root.google.spanner.v1.RequestOptions.fromObject(object.requestOptions); } + if (object.directedReadOptions != null) { + if (typeof object.directedReadOptions !== "object") + throw TypeError(".google.spanner.v1.ReadRequest.directedReadOptions: object expected"); + message.directedReadOptions = $root.google.spanner.v1.DirectedReadOptions.fromObject(object.directedReadOptions); + } if (object.dataBoostEnabled != null) message.dataBoostEnabled = Boolean(object.dataBoostEnabled); return message; @@ -50074,6 +51135,7 @@ object.partitionToken = $util.newBuffer(object.partitionToken); } object.requestOptions = null; + object.directedReadOptions = null; object.dataBoostEnabled = false; } if (message.session != null && message.hasOwnProperty("session")) @@ -50102,6 +51164,8 @@ object.partitionToken = options.bytes === String ? $util.base64.encode(message.partitionToken, 0, message.partitionToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.partitionToken) : message.partitionToken; if (message.requestOptions != null && message.hasOwnProperty("requestOptions")) object.requestOptions = $root.google.spanner.v1.RequestOptions.toObject(message.requestOptions, options); + if (message.directedReadOptions != null && message.hasOwnProperty("directedReadOptions")) + object.directedReadOptions = $root.google.spanner.v1.DirectedReadOptions.toObject(message.directedReadOptions, options); if (message.dataBoostEnabled != null && message.hasOwnProperty("dataBoostEnabled")) object.dataBoostEnabled = message.dataBoostEnabled; return object; diff --git a/protos/protos.json b/protos/protos.json index fe69a75ab..64a1319ec 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -4569,7 +4569,8 @@ "values": { "TYPE_ANNOTATION_CODE_UNSPECIFIED": 0, "PG_NUMERIC": 2, - "PG_JSONB": 3 + "PG_JSONB": 3, + "PG_OID": 4 } }, "Spanner": { @@ -5048,6 +5049,71 @@ } } }, + "DirectedReadOptions": { + "oneofs": { + "replicas": { + "oneof": [ + "includeReplicas", + "excludeReplicas" + ] + } + }, + "fields": { + "includeReplicas": { + "type": "IncludeReplicas", + "id": 1 + }, + "excludeReplicas": { + "type": "ExcludeReplicas", + "id": 2 + } + }, + "nested": { + "ReplicaSelection": { + "fields": { + "location": { + "type": "string", + "id": 1 + }, + "type": { + "type": "Type", + "id": 2 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "READ_WRITE": 1, + "READ_ONLY": 2 + } + } + } + }, + "IncludeReplicas": { + "fields": { + "replicaSelections": { + "rule": "repeated", + "type": "ReplicaSelection", + "id": 1 + }, + "autoFailoverDisabled": { + "type": "bool", + "id": 2 + } + } + }, + "ExcludeReplicas": { + "fields": { + "replicaSelections": { + "rule": "repeated", + "type": "ReplicaSelection", + "id": 1 + } + } + } + } + }, "ExecuteSqlRequest": { "fields": { "session": { @@ -5102,6 +5168,10 @@ "type": "RequestOptions", "id": 11 }, + "directedReadOptions": { + "type": "DirectedReadOptions", + "id": 15 + }, "dataBoostEnabled": { "type": "bool", "id": 16 @@ -5370,6 +5440,10 @@ "type": "RequestOptions", "id": 11 }, + "directedReadOptions": { + "type": "DirectedReadOptions", + "id": 14 + }, "dataBoostEnabled": { "type": "bool", "id": 15 diff --git a/src/v1/spanner_client.ts b/src/v1/spanner_client.ts index 84d8b455a..669cecadc 100644 --- a/src/v1/spanner_client.ts +++ b/src/v1/spanner_client.ts @@ -500,7 +500,8 @@ export class SpannerClient { * The API may return fewer than the requested number of sessions. If a * specific number of sessions are desired, the client can make additional * calls to BatchCreateSessions (adjusting - * {@link protos.google.spanner.v1.BatchCreateSessionsRequest.session_count|session_count} as necessary). + * {@link protos.google.spanner.v1.BatchCreateSessionsRequest.session_count|session_count} + * as necessary). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -748,10 +749,12 @@ export class SpannerClient { * * Operations inside read-write transactions might return `ABORTED`. If * this occurs, the application should restart the transaction from - * the beginning. See {@link protos.google.spanner.v1.Transaction|Transaction} for more details. + * the beginning. See {@link protos.google.spanner.v1.Transaction|Transaction} for more + * details. * * Larger result sets can be fetched in streaming fashion by calling - * {@link protos.google.spanner.v1.Spanner.ExecuteStreamingSql|ExecuteStreamingSql} instead. + * {@link protos.google.spanner.v1.Spanner.ExecuteStreamingSql|ExecuteStreamingSql} + * instead. * * @param {Object} request * The request object that will be sent. @@ -787,7 +790,8 @@ export class SpannerClient { * @param {number[]} request.paramTypes * It is not always possible for Cloud Spanner to infer the right SQL type * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in {@link protos.google.spanner.v1.ExecuteSqlRequest.params|params} as JSON strings. + * of type `STRING` both appear in + * {@link protos.google.spanner.v1.ExecuteSqlRequest.params|params} as JSON strings. * * In these cases, `param_types` can be used to specify the exact * SQL type for some or all of the SQL statement parameters. See the @@ -796,14 +800,17 @@ export class SpannerClient { * @param {Buffer} request.resumeToken * If this request is resuming a previously interrupted SQL statement * execution, `resume_token` should be copied from the last - * {@link protos.google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the interruption. Doing this - * enables the new SQL statement execution to resume where the last one left - * off. The rest of the request parameters must exactly match the - * request that yielded this token. + * {@link protos.google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. * @param {google.spanner.v1.ExecuteSqlRequest.QueryMode} request.queryMode * Used to control the amount of debugging information returned in - * {@link protos.google.spanner.v1.ResultSetStats|ResultSetStats}. If {@link protos.google.spanner.v1.ExecuteSqlRequest.partition_token|partition_token} is set, {@link protos.google.spanner.v1.ExecuteSqlRequest.query_mode|query_mode} can only - * be set to {@link protos.google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL|QueryMode.NORMAL}. + * {@link protos.google.spanner.v1.ResultSetStats|ResultSetStats}. If + * {@link protos.google.spanner.v1.ExecuteSqlRequest.partition_token|partition_token} is + * set, {@link protos.google.spanner.v1.ExecuteSqlRequest.query_mode|query_mode} can only + * be set to + * {@link protos.google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL|QueryMode.NORMAL}. * @param {Buffer} request.partitionToken * If present, results will be restricted to the specified partition * previously created using PartitionQuery(). There must be an exact @@ -824,12 +831,14 @@ export class SpannerClient { * Query optimizer configuration to use for the given query. * @param {google.spanner.v1.RequestOptions} request.requestOptions * Common options for this request. + * @param {google.spanner.v1.DirectedReadOptions} request.directedReadOptions + * Directed read options for this request. * @param {boolean} request.dataBoostEnabled * If this is for a partitioned query and this field is set to `true`, the - * request will be executed via Spanner independent compute resources. + * request is executed with Spanner Data Boost independent compute resources. * * If the field is set to `true` but the request does not set - * `partition_token`, the API will return an `INVALID_ARGUMENT` error. + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -909,9 +918,10 @@ export class SpannerClient { * {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql}. * * Statements are executed in sequential order. A request can succeed even if - * a statement fails. The {@link protos.google.spanner.v1.ExecuteBatchDmlResponse.status|ExecuteBatchDmlResponse.status} field in the - * response provides information about the statement that failed. Clients must - * inspect this field to determine whether an error occurred. + * a statement fails. The + * {@link protos.google.spanner.v1.ExecuteBatchDmlResponse.status|ExecuteBatchDmlResponse.status} + * field in the response provides information about the statement that failed. + * Clients must inspect this field to determine whether an error occurred. * * Execution stops after the first failed statement; the remaining statements * are not executed. @@ -927,16 +937,16 @@ export class SpannerClient { * caller must either supply an existing transaction ID or begin a new * transaction. * @param {number[]} request.statements - * Required. The list of statements to execute in this batch. Statements are executed - * serially, such that the effects of statement `i` are visible to statement - * `i+1`. Each statement must be a DML statement. Execution stops at the - * first failed statement; the remaining statements are not executed. + * Required. The list of statements to execute in this batch. Statements are + * executed serially, such that the effects of statement `i` are visible to + * statement `i+1`. Each statement must be a DML statement. Execution stops at + * the first failed statement; the remaining statements are not executed. * * Callers must provide at least one statement. * @param {number} request.seqno - * Required. A per-transaction sequence number used to identify this request. This field - * makes each request idempotent such that if the request is received multiple - * times, at most one will succeed. + * Required. A per-transaction sequence number used to identify this request. + * This field makes each request idempotent such that if the request is + * received multiple times, at most one will succeed. * * The sequence number must be monotonically increasing within the * transaction. If a request arrives for the first time with an out-of-order @@ -1020,14 +1030,15 @@ export class SpannerClient { /** * Reads rows from the database using key lookups and scans, as a * simple key/value style alternative to - * {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql}. This method cannot be used to - * return a result set larger than 10 MiB; if the read matches more + * {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql}. This method cannot be + * used to return a result set larger than 10 MiB; if the read matches more * data than that, the read fails with a `FAILED_PRECONDITION` * error. * * Reads inside read-write transactions might return `ABORTED`. If * this occurs, the application should restart the transaction from - * the beginning. See {@link protos.google.spanner.v1.Transaction|Transaction} for more details. + * the beginning. See {@link protos.google.spanner.v1.Transaction|Transaction} for more + * details. * * Larger result sets can be yielded in streaming fashion by calling * {@link protos.google.spanner.v1.Spanner.StreamingRead|StreamingRead} instead. @@ -1042,22 +1053,29 @@ export class SpannerClient { * @param {string} request.table * Required. The name of the table in the database to be read. * @param {string} request.index - * If non-empty, the name of an index on {@link protos.google.spanner.v1.ReadRequest.table|table}. This index is - * used instead of the table primary key when interpreting {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} - * and sorting result rows. See {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} for further information. + * If non-empty, the name of an index on + * {@link protos.google.spanner.v1.ReadRequest.table|table}. This index is used instead of + * the table primary key when interpreting + * {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} and sorting result rows. + * See {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} for further + * information. * @param {string[]} request.columns - * Required. The columns of {@link protos.google.spanner.v1.ReadRequest.table|table} to be returned for each row matching - * this request. + * Required. The columns of {@link protos.google.spanner.v1.ReadRequest.table|table} to be + * returned for each row matching this request. * @param {google.spanner.v1.KeySet} request.keySet * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in {@link protos.google.spanner.v1.ReadRequest.table|table} to be yielded, unless {@link protos.google.spanner.v1.ReadRequest.index|index} - * is present. If {@link protos.google.spanner.v1.ReadRequest.index|index} is present, then {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} instead names - * index keys in {@link protos.google.spanner.v1.ReadRequest.index|index}. - * - * If the {@link protos.google.spanner.v1.ReadRequest.partition_token|partition_token} field is empty, rows are yielded - * in table primary key order (if {@link protos.google.spanner.v1.ReadRequest.index|index} is empty) or index key order - * (if {@link protos.google.spanner.v1.ReadRequest.index|index} is non-empty). If the {@link protos.google.spanner.v1.ReadRequest.partition_token|partition_token} field is not - * empty, rows will be yielded in an unspecified order. + * primary keys of the rows in {@link protos.google.spanner.v1.ReadRequest.table|table} to + * be yielded, unless {@link protos.google.spanner.v1.ReadRequest.index|index} is present. + * If {@link protos.google.spanner.v1.ReadRequest.index|index} is present, then + * {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} instead names index keys + * in {@link protos.google.spanner.v1.ReadRequest.index|index}. + * + * If the {@link protos.google.spanner.v1.ReadRequest.partition_token|partition_token} + * field is empty, rows are yielded in table primary key order (if + * {@link protos.google.spanner.v1.ReadRequest.index|index} is empty) or index key order + * (if {@link protos.google.spanner.v1.ReadRequest.index|index} is non-empty). If the + * {@link protos.google.spanner.v1.ReadRequest.partition_token|partition_token} field is + * not empty, rows will be yielded in an unspecified order. * * It is not an error for the `key_set` to name rows that do not * exist in the database. Read yields nothing for nonexistent rows. @@ -1068,9 +1086,9 @@ export class SpannerClient { * @param {Buffer} request.resumeToken * If this request is resuming a previously interrupted read, * `resume_token` should be copied from the last - * {@link protos.google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the interruption. Doing this - * enables the new read to resume where the last read left off. The - * rest of the request parameters must exactly match the request + * {@link protos.google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request * that yielded this token. * @param {Buffer} request.partitionToken * If present, results will be restricted to the specified partition @@ -1079,12 +1097,14 @@ export class SpannerClient { * PartitionReadRequest message used to create this partition_token. * @param {google.spanner.v1.RequestOptions} request.requestOptions * Common options for this request. + * @param {google.spanner.v1.DirectedReadOptions} request.directedReadOptions + * Directed read options for this request. * @param {boolean} request.dataBoostEnabled * If this is for a partitioned read and this field is set to `true`, the - * request will be executed via Spanner independent compute resources. + * request is executed with Spanner Data Boost independent compute resources. * * If the field is set to `true` but the request does not set - * `partition_token`, the API will return an `INVALID_ARGUMENT` error. + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1160,7 +1180,8 @@ export class SpannerClient { } /** * Begins a new transaction. This step can often be skipped: - * {@link protos.google.spanner.v1.Spanner.Read|Read}, {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql} and + * {@link protos.google.spanner.v1.Spanner.Read|Read}, + * {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql} and * {@link protos.google.spanner.v1.Spanner.Commit|Commit} can begin a new transaction as a * side-effect. * @@ -1287,8 +1308,8 @@ export class SpannerClient { * this list. * @param {boolean} request.returnCommitStats * If `true`, then statistics related to the transaction will be included in - * the {@link protos.google.spanner.v1.CommitResponse.commit_stats|CommitResponse}. Default value is - * `false`. + * the {@link protos.google.spanner.v1.CommitResponse.commit_stats|CommitResponse}. + * Default value is `false`. * @param {google.spanner.v1.RequestOptions} request.requestOptions * Common options for this request. * @param {object} [options] @@ -1367,8 +1388,9 @@ export class SpannerClient { /** * Rolls back a transaction, releasing any locks it holds. It is a good * idea to call this for any transaction that includes one or more - * {@link protos.google.spanner.v1.Spanner.Read|Read} or {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql} requests and - * ultimately decides not to commit. + * {@link protos.google.spanner.v1.Spanner.Read|Read} or + * {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql} requests and ultimately + * decides not to commit. * * `Rollback` returns `OK` if it successfully aborts the transaction, the * transaction was already aborted, or the transaction is not @@ -1456,10 +1478,11 @@ export class SpannerClient { /** * Creates a set of partition tokens that can be used to execute a query * operation in parallel. Each of the returned partition tokens can be used - * by {@link protos.google.spanner.v1.Spanner.ExecuteStreamingSql|ExecuteStreamingSql} to specify a subset - * of the query result to read. The same session and read-only transaction - * must be used by the PartitionQueryRequest used to create the - * partition tokens and the ExecuteSqlRequests that use the partition tokens. + * by {@link protos.google.spanner.v1.Spanner.ExecuteStreamingSql|ExecuteStreamingSql} to + * specify a subset of the query result to read. The same session and + * read-only transaction must be used by the PartitionQueryRequest used to + * create the partition tokens and the ExecuteSqlRequests that use the + * partition tokens. * * Partition tokens become invalid when the session used to create them * is deleted, is idle for too long, begins a new transaction, or becomes too @@ -1474,15 +1497,16 @@ export class SpannerClient { * Read only snapshot transactions are supported, read/write and single use * transactions are not. * @param {string} request.sql - * Required. The query request to generate partitions for. The request will fail if - * the query is not root partitionable. The query plan of a root - * partitionable query has a single distributed union operator. A distributed - * union operator conceptually divides one or more tables into multiple - * splits, remotely evaluates a subquery independently on each split, and - * then unions all results. - * - * This must not contain DML commands, such as INSERT, UPDATE, or - * DELETE. Use {@link protos.google.spanner.v1.Spanner.ExecuteStreamingSql|ExecuteStreamingSql} with a + * Required. The query request to generate partitions for. The request will + * fail if the query is not root partitionable. For a query to be root + * partitionable, it needs to satisfy a few conditions. For example, the first + * operator in the query execution plan must be a distributed union operator. + * For more information about other conditions, see [Read data in + * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). + * + * The query request must not contain DML commands, such as INSERT, UPDATE, or + * DELETE. Use + * {@link protos.google.spanner.v1.Spanner.ExecuteStreamingSql|ExecuteStreamingSql} with a * PartitionedDml transaction for large, partition-friendly DML operations. * @param {google.protobuf.Struct} request.params * Parameter names and values that bind to placeholders in the SQL string. @@ -1500,7 +1524,8 @@ export class SpannerClient { * @param {number[]} request.paramTypes * It is not always possible for Cloud Spanner to infer the right SQL type * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in {@link protos.google.spanner.v1.PartitionQueryRequest.params|params} as JSON strings. + * of type `STRING` both appear in + * {@link protos.google.spanner.v1.PartitionQueryRequest.params|params} as JSON strings. * * In these cases, `param_types` can be used to specify the exact * SQL type for some or all of the SQL query parameters. See the @@ -1584,12 +1609,13 @@ export class SpannerClient { /** * Creates a set of partition tokens that can be used to execute a read * operation in parallel. Each of the returned partition tokens can be used - * by {@link protos.google.spanner.v1.Spanner.StreamingRead|StreamingRead} to specify a subset of the read - * result to read. The same session and read-only transaction must be used by - * the PartitionReadRequest used to create the partition tokens and the - * ReadRequests that use the partition tokens. There are no ordering - * guarantees on rows returned among the returned partition tokens, or even - * within each individual StreamingRead call issued with a partition_token. + * by {@link protos.google.spanner.v1.Spanner.StreamingRead|StreamingRead} to specify a + * subset of the read result to read. The same session and read-only + * transaction must be used by the PartitionReadRequest used to create the + * partition tokens and the ReadRequests that use the partition tokens. There + * are no ordering guarantees on rows returned among the returned partition + * tokens, or even within each individual StreamingRead call issued with a + * partition_token. * * Partition tokens become invalid when the session used to create them * is deleted, is idle for too long, begins a new transaction, or becomes too @@ -1606,16 +1632,22 @@ export class SpannerClient { * @param {string} request.table * Required. The name of the table in the database to be read. * @param {string} request.index - * If non-empty, the name of an index on {@link protos.google.spanner.v1.PartitionReadRequest.table|table}. This index is - * used instead of the table primary key when interpreting {@link protos.google.spanner.v1.PartitionReadRequest.key_set|key_set} - * and sorting result rows. See {@link protos.google.spanner.v1.PartitionReadRequest.key_set|key_set} for further information. + * If non-empty, the name of an index on + * {@link protos.google.spanner.v1.PartitionReadRequest.table|table}. This index is used + * instead of the table primary key when interpreting + * {@link protos.google.spanner.v1.PartitionReadRequest.key_set|key_set} and sorting + * result rows. See {@link protos.google.spanner.v1.PartitionReadRequest.key_set|key_set} + * for further information. * @param {string[]} request.columns - * The columns of {@link protos.google.spanner.v1.PartitionReadRequest.table|table} to be returned for each row matching - * this request. + * The columns of {@link protos.google.spanner.v1.PartitionReadRequest.table|table} to be + * returned for each row matching this request. * @param {google.spanner.v1.KeySet} request.keySet * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in {@link protos.google.spanner.v1.PartitionReadRequest.table|table} to be yielded, unless {@link protos.google.spanner.v1.PartitionReadRequest.index|index} - * is present. If {@link protos.google.spanner.v1.PartitionReadRequest.index|index} is present, then {@link protos.google.spanner.v1.PartitionReadRequest.key_set|key_set} instead names + * primary keys of the rows in + * {@link protos.google.spanner.v1.PartitionReadRequest.table|table} to be yielded, unless + * {@link protos.google.spanner.v1.PartitionReadRequest.index|index} is present. If + * {@link protos.google.spanner.v1.PartitionReadRequest.index|index} is present, then + * {@link protos.google.spanner.v1.PartitionReadRequest.key_set|key_set} instead names * index keys in {@link protos.google.spanner.v1.PartitionReadRequest.index|index}. * * It is not an error for the `key_set` to name rows that do not @@ -1697,11 +1729,11 @@ export class SpannerClient { } /** - * Like {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql}, except returns the result - * set as a stream. Unlike {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql}, there - * is no limit on the size of the returned result set. However, no - * individual row in the result set can exceed 100 MiB, and no - * column value can exceed 10 MiB. + * Like {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql}, except returns the + * result set as a stream. Unlike + * {@link protos.google.spanner.v1.Spanner.ExecuteSql|ExecuteSql}, there is no limit on + * the size of the returned result set. However, no individual row in the + * result set can exceed 100 MiB, and no column value can exceed 10 MiB. * * @param {Object} request * The request object that will be sent. @@ -1737,7 +1769,8 @@ export class SpannerClient { * @param {number[]} request.paramTypes * It is not always possible for Cloud Spanner to infer the right SQL type * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in {@link protos.google.spanner.v1.ExecuteSqlRequest.params|params} as JSON strings. + * of type `STRING` both appear in + * {@link protos.google.spanner.v1.ExecuteSqlRequest.params|params} as JSON strings. * * In these cases, `param_types` can be used to specify the exact * SQL type for some or all of the SQL statement parameters. See the @@ -1746,14 +1779,17 @@ export class SpannerClient { * @param {Buffer} request.resumeToken * If this request is resuming a previously interrupted SQL statement * execution, `resume_token` should be copied from the last - * {@link protos.google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the interruption. Doing this - * enables the new SQL statement execution to resume where the last one left - * off. The rest of the request parameters must exactly match the - * request that yielded this token. + * {@link protos.google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. * @param {google.spanner.v1.ExecuteSqlRequest.QueryMode} request.queryMode * Used to control the amount of debugging information returned in - * {@link protos.google.spanner.v1.ResultSetStats|ResultSetStats}. If {@link protos.google.spanner.v1.ExecuteSqlRequest.partition_token|partition_token} is set, {@link protos.google.spanner.v1.ExecuteSqlRequest.query_mode|query_mode} can only - * be set to {@link protos.google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL|QueryMode.NORMAL}. + * {@link protos.google.spanner.v1.ResultSetStats|ResultSetStats}. If + * {@link protos.google.spanner.v1.ExecuteSqlRequest.partition_token|partition_token} is + * set, {@link protos.google.spanner.v1.ExecuteSqlRequest.query_mode|query_mode} can only + * be set to + * {@link protos.google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL|QueryMode.NORMAL}. * @param {Buffer} request.partitionToken * If present, results will be restricted to the specified partition * previously created using PartitionQuery(). There must be an exact @@ -1774,12 +1810,14 @@ export class SpannerClient { * Query optimizer configuration to use for the given query. * @param {google.spanner.v1.RequestOptions} request.requestOptions * Common options for this request. + * @param {google.spanner.v1.DirectedReadOptions} request.directedReadOptions + * Directed read options for this request. * @param {boolean} request.dataBoostEnabled * If this is for a partitioned query and this field is set to `true`, the - * request will be executed via Spanner independent compute resources. + * request is executed with Spanner Data Boost independent compute resources. * * If the field is set to `true` but the request does not set - * `partition_token`, the API will return an `INVALID_ARGUMENT` error. + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -1804,9 +1842,9 @@ export class SpannerClient { } /** - * Like {@link protos.google.spanner.v1.Spanner.Read|Read}, except returns the result set as a - * stream. Unlike {@link protos.google.spanner.v1.Spanner.Read|Read}, there is no limit on the - * size of the returned result set. However, no individual row in + * Like {@link protos.google.spanner.v1.Spanner.Read|Read}, except returns the result set + * as a stream. Unlike {@link protos.google.spanner.v1.Spanner.Read|Read}, there is no + * limit on the size of the returned result set. However, no individual row in * the result set can exceed 100 MiB, and no column value can exceed * 10 MiB. * @@ -1820,22 +1858,29 @@ export class SpannerClient { * @param {string} request.table * Required. The name of the table in the database to be read. * @param {string} request.index - * If non-empty, the name of an index on {@link protos.google.spanner.v1.ReadRequest.table|table}. This index is - * used instead of the table primary key when interpreting {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} - * and sorting result rows. See {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} for further information. + * If non-empty, the name of an index on + * {@link protos.google.spanner.v1.ReadRequest.table|table}. This index is used instead of + * the table primary key when interpreting + * {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} and sorting result rows. + * See {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} for further + * information. * @param {string[]} request.columns - * Required. The columns of {@link protos.google.spanner.v1.ReadRequest.table|table} to be returned for each row matching - * this request. + * Required. The columns of {@link protos.google.spanner.v1.ReadRequest.table|table} to be + * returned for each row matching this request. * @param {google.spanner.v1.KeySet} request.keySet * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in {@link protos.google.spanner.v1.ReadRequest.table|table} to be yielded, unless {@link protos.google.spanner.v1.ReadRequest.index|index} - * is present. If {@link protos.google.spanner.v1.ReadRequest.index|index} is present, then {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} instead names - * index keys in {@link protos.google.spanner.v1.ReadRequest.index|index}. - * - * If the {@link protos.google.spanner.v1.ReadRequest.partition_token|partition_token} field is empty, rows are yielded - * in table primary key order (if {@link protos.google.spanner.v1.ReadRequest.index|index} is empty) or index key order - * (if {@link protos.google.spanner.v1.ReadRequest.index|index} is non-empty). If the {@link protos.google.spanner.v1.ReadRequest.partition_token|partition_token} field is not - * empty, rows will be yielded in an unspecified order. + * primary keys of the rows in {@link protos.google.spanner.v1.ReadRequest.table|table} to + * be yielded, unless {@link protos.google.spanner.v1.ReadRequest.index|index} is present. + * If {@link protos.google.spanner.v1.ReadRequest.index|index} is present, then + * {@link protos.google.spanner.v1.ReadRequest.key_set|key_set} instead names index keys + * in {@link protos.google.spanner.v1.ReadRequest.index|index}. + * + * If the {@link protos.google.spanner.v1.ReadRequest.partition_token|partition_token} + * field is empty, rows are yielded in table primary key order (if + * {@link protos.google.spanner.v1.ReadRequest.index|index} is empty) or index key order + * (if {@link protos.google.spanner.v1.ReadRequest.index|index} is non-empty). If the + * {@link protos.google.spanner.v1.ReadRequest.partition_token|partition_token} field is + * not empty, rows will be yielded in an unspecified order. * * It is not an error for the `key_set` to name rows that do not * exist in the database. Read yields nothing for nonexistent rows. @@ -1846,9 +1891,9 @@ export class SpannerClient { * @param {Buffer} request.resumeToken * If this request is resuming a previously interrupted read, * `resume_token` should be copied from the last - * {@link protos.google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the interruption. Doing this - * enables the new read to resume where the last read left off. The - * rest of the request parameters must exactly match the request + * {@link protos.google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request * that yielded this token. * @param {Buffer} request.partitionToken * If present, results will be restricted to the specified partition @@ -1857,12 +1902,14 @@ export class SpannerClient { * PartitionReadRequest message used to create this partition_token. * @param {google.spanner.v1.RequestOptions} request.requestOptions * Common options for this request. + * @param {google.spanner.v1.DirectedReadOptions} request.directedReadOptions + * Directed read options for this request. * @param {boolean} request.dataBoostEnabled * If this is for a partitioned read and this field is set to `true`, the - * request will be executed via Spanner independent compute resources. + * request is executed with Spanner Data Boost independent compute resources. * * If the field is set to `true` but the request does not set - * `partition_token`, the API will return an `INVALID_ARGUMENT` error. + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -1946,7 +1993,8 @@ export class SpannerClient { * to the server's maximum allowed page size. * @param {string} request.pageToken * If non-empty, `page_token` should contain a - * {@link protos.google.spanner.v1.ListSessionsResponse.next_page_token|next_page_token} from a previous + * {@link protos.google.spanner.v1.ListSessionsResponse.next_page_token|next_page_token} + * from a previous * {@link protos.google.spanner.v1.ListSessionsResponse|ListSessionsResponse}. * @param {string} request.filter * An expression for filtering the results of the request. Filter rules are @@ -2049,7 +2097,8 @@ export class SpannerClient { * to the server's maximum allowed page size. * @param {string} request.pageToken * If non-empty, `page_token` should contain a - * {@link protos.google.spanner.v1.ListSessionsResponse.next_page_token|next_page_token} from a previous + * {@link protos.google.spanner.v1.ListSessionsResponse.next_page_token|next_page_token} + * from a previous * {@link protos.google.spanner.v1.ListSessionsResponse|ListSessionsResponse}. * @param {string} request.filter * An expression for filtering the results of the request. Filter rules are @@ -2108,7 +2157,8 @@ export class SpannerClient { * to the server's maximum allowed page size. * @param {string} request.pageToken * If non-empty, `page_token` should contain a - * {@link protos.google.spanner.v1.ListSessionsResponse.next_page_token|next_page_token} from a previous + * {@link protos.google.spanner.v1.ListSessionsResponse.next_page_token|next_page_token} + * from a previous * {@link protos.google.spanner.v1.ListSessionsResponse|ListSessionsResponse}. * @param {string} request.filter * An expression for filtering the results of the request. Filter rules are