@google-cloud/spanner 5.15.0 → 5.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -258,43 +258,6 @@ class SpannerClient {
258
258
  }
259
259
  return this.auth.getProjectId();
260
260
  }
261
- /**
262
- * Creates a new session. A session can be used to perform
263
- * transactions that read and/or modify data in a Cloud Spanner database.
264
- * Sessions are meant to be reused for many consecutive
265
- * transactions.
266
- *
267
- * Sessions can only execute one transaction at a time. To execute
268
- * multiple concurrent read-write/write-only transactions, create
269
- * multiple sessions. Note that standalone reads and queries use a
270
- * transaction internally, and count toward the one transaction
271
- * limit.
272
- *
273
- * Active sessions use additional server resources, so it is a good idea to
274
- * delete idle and unneeded sessions.
275
- * Aside from explicit deletes, Cloud Spanner may delete sessions for which no
276
- * operations are sent for more than an hour. If a session is deleted,
277
- * requests to it return `NOT_FOUND`.
278
- *
279
- * Idle sessions can be kept alive by sending a trivial SQL query
280
- * periodically, e.g., `"SELECT 1"`.
281
- *
282
- * @param {Object} request
283
- * The request object that will be sent.
284
- * @param {string} request.database
285
- * Required. The database in which the new session is created.
286
- * @param {google.spanner.v1.Session} request.session
287
- * The session to create.
288
- * @param {object} [options]
289
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
290
- * @returns {Promise} - The promise which resolves to an array.
291
- * The first element of the array is an object representing [Session]{@link google.spanner.v1.Session}.
292
- * Please see the
293
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
294
- * for more details and examples.
295
- * @example
296
- * const [response] = await client.createSession(request);
297
- */
298
261
  createSession(request, optionsOrCallback, callback) {
299
262
  request = request || {};
300
263
  let options;
@@ -315,34 +278,6 @@ class SpannerClient {
315
278
  this.initialize();
316
279
  return this.innerApiCalls.createSession(request, options, callback);
317
280
  }
318
- /**
319
- * Creates multiple new sessions.
320
- *
321
- * This API can be used to initialize a session cache on the clients.
322
- * See https://goo.gl/TgSFN2 for best practices on session cache management.
323
- *
324
- * @param {Object} request
325
- * The request object that will be sent.
326
- * @param {string} request.database
327
- * Required. The database in which the new sessions are created.
328
- * @param {google.spanner.v1.Session} request.sessionTemplate
329
- * Parameters to be applied to each created session.
330
- * @param {number} request.sessionCount
331
- * Required. The number of sessions to be created in this batch call.
332
- * The API may return fewer than the requested number of sessions. If a
333
- * specific number of sessions are desired, the client can make additional
334
- * calls to BatchCreateSessions (adjusting
335
- * {@link google.spanner.v1.BatchCreateSessionsRequest.session_count|session_count} as necessary).
336
- * @param {object} [options]
337
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
338
- * @returns {Promise} - The promise which resolves to an array.
339
- * The first element of the array is an object representing [BatchCreateSessionsResponse]{@link google.spanner.v1.BatchCreateSessionsResponse}.
340
- * Please see the
341
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
342
- * for more details and examples.
343
- * @example
344
- * const [response] = await client.batchCreateSessions(request);
345
- */
346
281
  batchCreateSessions(request, optionsOrCallback, callback) {
347
282
  request = request || {};
348
283
  let options;
@@ -363,25 +298,6 @@ class SpannerClient {
363
298
  this.initialize();
364
299
  return this.innerApiCalls.batchCreateSessions(request, options, callback);
365
300
  }
366
- /**
367
- * Gets a session. Returns `NOT_FOUND` if the session does not exist.
368
- * This is mainly useful for determining whether a session is still
369
- * alive.
370
- *
371
- * @param {Object} request
372
- * The request object that will be sent.
373
- * @param {string} request.name
374
- * Required. The name of the session to retrieve.
375
- * @param {object} [options]
376
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
377
- * @returns {Promise} - The promise which resolves to an array.
378
- * The first element of the array is an object representing [Session]{@link google.spanner.v1.Session}.
379
- * Please see the
380
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
381
- * for more details and examples.
382
- * @example
383
- * const [response] = await client.getSession(request);
384
- */
385
301
  getSession(request, optionsOrCallback, callback) {
386
302
  request = request || {};
387
303
  let options;
@@ -402,25 +318,6 @@ class SpannerClient {
402
318
  this.initialize();
403
319
  return this.innerApiCalls.getSession(request, options, callback);
404
320
  }
405
- /**
406
- * Ends a session, releasing server resources associated with it. This will
407
- * asynchronously trigger cancellation of any operations that are running with
408
- * this session.
409
- *
410
- * @param {Object} request
411
- * The request object that will be sent.
412
- * @param {string} request.name
413
- * Required. The name of the session to delete.
414
- * @param {object} [options]
415
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
416
- * @returns {Promise} - The promise which resolves to an array.
417
- * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
418
- * Please see the
419
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
420
- * for more details and examples.
421
- * @example
422
- * const [response] = await client.deleteSession(request);
423
- */
424
321
  deleteSession(request, optionsOrCallback, callback) {
425
322
  request = request || {};
426
323
  let options;
@@ -441,100 +338,6 @@ class SpannerClient {
441
338
  this.initialize();
442
339
  return this.innerApiCalls.deleteSession(request, options, callback);
443
340
  }
444
- /**
445
- * Executes an SQL statement, returning all results in a single reply. This
446
- * method cannot be used to return a result set larger than 10 MiB;
447
- * if the query yields more data than that, the query fails with
448
- * a `FAILED_PRECONDITION` error.
449
- *
450
- * Operations inside read-write transactions might return `ABORTED`. If
451
- * this occurs, the application should restart the transaction from
452
- * the beginning. See {@link google.spanner.v1.Transaction|Transaction} for more details.
453
- *
454
- * Larger result sets can be fetched in streaming fashion by calling
455
- * {@link google.spanner.v1.Spanner.ExecuteStreamingSql|ExecuteStreamingSql} instead.
456
- *
457
- * @param {Object} request
458
- * The request object that will be sent.
459
- * @param {string} request.session
460
- * Required. The session in which the SQL query should be performed.
461
- * @param {google.spanner.v1.TransactionSelector} request.transaction
462
- * The transaction to use.
463
- *
464
- * For queries, if none is provided, the default is a temporary read-only
465
- * transaction with strong concurrency.
466
- *
467
- * Standard DML statements require a read-write transaction. To protect
468
- * against replays, single-use transactions are not supported. The caller
469
- * must either supply an existing transaction ID or begin a new transaction.
470
- *
471
- * Partitioned DML requires an existing Partitioned DML transaction ID.
472
- * @param {string} request.sql
473
- * Required. The SQL string.
474
- * @param {google.protobuf.Struct} request.params
475
- * Parameter names and values that bind to placeholders in the SQL string.
476
- *
477
- * A parameter placeholder consists of the `@` character followed by the
478
- * parameter name (for example, `@firstName`). Parameter names must conform
479
- * to the naming requirements of identifiers as specified at
480
- * https://cloud.google.com/spanner/docs/lexical#identifiers.
481
- *
482
- * Parameters can appear anywhere that a literal value is expected. The same
483
- * parameter name can be used more than once, for example:
484
- *
485
- * `"WHERE id > @msg_id AND id < @msg_id + 100"`
486
- *
487
- * It is an error to execute a SQL statement with unbound parameters.
488
- * @param {number[]} request.paramTypes
489
- * It is not always possible for Cloud Spanner to infer the right SQL type
490
- * from a JSON value. For example, values of type `BYTES` and values
491
- * of type `STRING` both appear in {@link google.spanner.v1.ExecuteSqlRequest.params|params} as JSON strings.
492
- *
493
- * In these cases, `param_types` can be used to specify the exact
494
- * SQL type for some or all of the SQL statement parameters. See the
495
- * definition of {@link google.spanner.v1.Type|Type} for more information
496
- * about SQL types.
497
- * @param {Buffer} request.resumeToken
498
- * If this request is resuming a previously interrupted SQL statement
499
- * execution, `resume_token` should be copied from the last
500
- * {@link google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the interruption. Doing this
501
- * enables the new SQL statement execution to resume where the last one left
502
- * off. The rest of the request parameters must exactly match the
503
- * request that yielded this token.
504
- * @param {google.spanner.v1.ExecuteSqlRequest.QueryMode} request.queryMode
505
- * Used to control the amount of debugging information returned in
506
- * {@link google.spanner.v1.ResultSetStats|ResultSetStats}. If {@link google.spanner.v1.ExecuteSqlRequest.partition_token|partition_token} is set, {@link google.spanner.v1.ExecuteSqlRequest.query_mode|query_mode} can only
507
- * be set to {@link google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL|QueryMode.NORMAL}.
508
- * @param {Buffer} request.partitionToken
509
- * If present, results will be restricted to the specified partition
510
- * previously created using PartitionQuery(). There must be an exact
511
- * match for the values of fields common to this message and the
512
- * PartitionQueryRequest message used to create this partition_token.
513
- * @param {number} request.seqno
514
- * A per-transaction sequence number used to identify this request. This field
515
- * makes each request idempotent such that if the request is received multiple
516
- * times, at most one will succeed.
517
- *
518
- * The sequence number must be monotonically increasing within the
519
- * transaction. If a request arrives for the first time with an out-of-order
520
- * sequence number, the transaction may be aborted. Replays of previously
521
- * handled requests will yield the same response as the first execution.
522
- *
523
- * Required for DML statements. Ignored for queries.
524
- * @param {google.spanner.v1.ExecuteSqlRequest.QueryOptions} request.queryOptions
525
- * Query optimizer configuration to use for the given query.
526
- * @param {google.spanner.v1.RequestOptions} request.requestOptions
527
- * Common options for this request.
528
- * @param {object} [options]
529
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
530
- * @returns {Promise} - The promise which resolves to an array.
531
- * The first element of the array is an object representing [ResultSet]{@link google.spanner.v1.ResultSet}.
532
- * Please see the
533
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
534
- * for more details and examples.
535
- * @example
536
- * const [response] = await client.executeSql(request);
537
- */
538
341
  executeSql(request, optionsOrCallback, callback) {
539
342
  request = request || {};
540
343
  let options;
@@ -555,57 +358,6 @@ class SpannerClient {
555
358
  this.initialize();
556
359
  return this.innerApiCalls.executeSql(request, options, callback);
557
360
  }
558
- /**
559
- * Executes a batch of SQL DML statements. This method allows many statements
560
- * to be run with lower latency than submitting them sequentially with
561
- * {@link google.spanner.v1.Spanner.ExecuteSql|ExecuteSql}.
562
- *
563
- * Statements are executed in sequential order. A request can succeed even if
564
- * a statement fails. The {@link google.spanner.v1.ExecuteBatchDmlResponse.status|ExecuteBatchDmlResponse.status} field in the
565
- * response provides information about the statement that failed. Clients must
566
- * inspect this field to determine whether an error occurred.
567
- *
568
- * Execution stops after the first failed statement; the remaining statements
569
- * are not executed.
570
- *
571
- * @param {Object} request
572
- * The request object that will be sent.
573
- * @param {string} request.session
574
- * Required. The session in which the DML statements should be performed.
575
- * @param {google.spanner.v1.TransactionSelector} request.transaction
576
- * Required. The transaction to use. Must be a read-write transaction.
577
- *
578
- * To protect against replays, single-use transactions are not supported. The
579
- * caller must either supply an existing transaction ID or begin a new
580
- * transaction.
581
- * @param {number[]} request.statements
582
- * Required. The list of statements to execute in this batch. Statements are executed
583
- * serially, such that the effects of statement `i` are visible to statement
584
- * `i+1`. Each statement must be a DML statement. Execution stops at the
585
- * first failed statement; the remaining statements are not executed.
586
- *
587
- * Callers must provide at least one statement.
588
- * @param {number} request.seqno
589
- * Required. A per-transaction sequence number used to identify this request. This field
590
- * makes each request idempotent such that if the request is received multiple
591
- * times, at most one will succeed.
592
- *
593
- * The sequence number must be monotonically increasing within the
594
- * transaction. If a request arrives for the first time with an out-of-order
595
- * sequence number, the transaction may be aborted. Replays of previously
596
- * handled requests will yield the same response as the first execution.
597
- * @param {google.spanner.v1.RequestOptions} request.requestOptions
598
- * Common options for this request.
599
- * @param {object} [options]
600
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
601
- * @returns {Promise} - The promise which resolves to an array.
602
- * The first element of the array is an object representing [ExecuteBatchDmlResponse]{@link google.spanner.v1.ExecuteBatchDmlResponse}.
603
- * Please see the
604
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
605
- * for more details and examples.
606
- * @example
607
- * const [response] = await client.executeBatchDml(request);
608
- */
609
361
  executeBatchDml(request, optionsOrCallback, callback) {
610
362
  request = request || {};
611
363
  let options;
@@ -626,78 +378,6 @@ class SpannerClient {
626
378
  this.initialize();
627
379
  return this.innerApiCalls.executeBatchDml(request, options, callback);
628
380
  }
629
- /**
630
- * Reads rows from the database using key lookups and scans, as a
631
- * simple key/value style alternative to
632
- * {@link google.spanner.v1.Spanner.ExecuteSql|ExecuteSql}. This method cannot be used to
633
- * return a result set larger than 10 MiB; if the read matches more
634
- * data than that, the read fails with a `FAILED_PRECONDITION`
635
- * error.
636
- *
637
- * Reads inside read-write transactions might return `ABORTED`. If
638
- * this occurs, the application should restart the transaction from
639
- * the beginning. See {@link google.spanner.v1.Transaction|Transaction} for more details.
640
- *
641
- * Larger result sets can be yielded in streaming fashion by calling
642
- * {@link google.spanner.v1.Spanner.StreamingRead|StreamingRead} instead.
643
- *
644
- * @param {Object} request
645
- * The request object that will be sent.
646
- * @param {string} request.session
647
- * Required. The session in which the read should be performed.
648
- * @param {google.spanner.v1.TransactionSelector} request.transaction
649
- * The transaction to use. If none is provided, the default is a
650
- * temporary read-only transaction with strong concurrency.
651
- * @param {string} request.table
652
- * Required. The name of the table in the database to be read.
653
- * @param {string} request.index
654
- * If non-empty, the name of an index on {@link google.spanner.v1.ReadRequest.table|table}. This index is
655
- * used instead of the table primary key when interpreting {@link google.spanner.v1.ReadRequest.key_set|key_set}
656
- * and sorting result rows. See {@link google.spanner.v1.ReadRequest.key_set|key_set} for further information.
657
- * @param {string[]} request.columns
658
- * Required. The columns of {@link google.spanner.v1.ReadRequest.table|table} to be returned for each row matching
659
- * this request.
660
- * @param {google.spanner.v1.KeySet} request.keySet
661
- * Required. `key_set` identifies the rows to be yielded. `key_set` names the
662
- * primary keys of the rows in {@link google.spanner.v1.ReadRequest.table|table} to be yielded, unless {@link google.spanner.v1.ReadRequest.index|index}
663
- * is present. If {@link google.spanner.v1.ReadRequest.index|index} is present, then {@link google.spanner.v1.ReadRequest.key_set|key_set} instead names
664
- * index keys in {@link google.spanner.v1.ReadRequest.index|index}.
665
- *
666
- * If the {@link google.spanner.v1.ReadRequest.partition_token|partition_token} field is empty, rows are yielded
667
- * in table primary key order (if {@link google.spanner.v1.ReadRequest.index|index} is empty) or index key order
668
- * (if {@link google.spanner.v1.ReadRequest.index|index} is non-empty). If the {@link google.spanner.v1.ReadRequest.partition_token|partition_token} field is not
669
- * empty, rows will be yielded in an unspecified order.
670
- *
671
- * It is not an error for the `key_set` to name rows that do not
672
- * exist in the database. Read yields nothing for nonexistent rows.
673
- * @param {number} request.limit
674
- * If greater than zero, only the first `limit` rows are yielded. If `limit`
675
- * is zero, the default is no limit. A limit cannot be specified if
676
- * `partition_token` is set.
677
- * @param {Buffer} request.resumeToken
678
- * If this request is resuming a previously interrupted read,
679
- * `resume_token` should be copied from the last
680
- * {@link google.spanner.v1.PartialResultSet|PartialResultSet} yielded before the interruption. Doing this
681
- * enables the new read to resume where the last read left off. The
682
- * rest of the request parameters must exactly match the request
683
- * that yielded this token.
684
- * @param {Buffer} request.partitionToken
685
- * If present, results will be restricted to the specified partition
686
- * previously created using PartitionRead(). There must be an exact
687
- * match for the values of fields common to this message and the
688
- * PartitionReadRequest message used to create this partition_token.
689
- * @param {google.spanner.v1.RequestOptions} request.requestOptions
690
- * Common options for this request.
691
- * @param {object} [options]
692
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
693
- * @returns {Promise} - The promise which resolves to an array.
694
- * The first element of the array is an object representing [ResultSet]{@link google.spanner.v1.ResultSet}.
695
- * Please see the
696
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
697
- * for more details and examples.
698
- * @example
699
- * const [response] = await client.read(request);
700
- */
701
381
  read(request, optionsOrCallback, callback) {
702
382
  request = request || {};
703
383
  let options;
@@ -718,34 +398,6 @@ class SpannerClient {
718
398
  this.initialize();
719
399
  return this.innerApiCalls.read(request, options, callback);
720
400
  }
721
- /**
722
- * Begins a new transaction. This step can often be skipped:
723
- * {@link google.spanner.v1.Spanner.Read|Read}, {@link google.spanner.v1.Spanner.ExecuteSql|ExecuteSql} and
724
- * {@link google.spanner.v1.Spanner.Commit|Commit} can begin a new transaction as a
725
- * side-effect.
726
- *
727
- * @param {Object} request
728
- * The request object that will be sent.
729
- * @param {string} request.session
730
- * Required. The session in which the transaction runs.
731
- * @param {google.spanner.v1.TransactionOptions} request.options
732
- * Required. Options for the new transaction.
733
- * @param {google.spanner.v1.RequestOptions} request.requestOptions
734
- * Common options for this request.
735
- * Priority is ignored for this request. Setting the priority in this
736
- * request_options struct will not do anything. To set the priority for a
737
- * transaction, set it on the reads and writes that are part of this
738
- * transaction instead.
739
- * @param {object} [options]
740
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
741
- * @returns {Promise} - The promise which resolves to an array.
742
- * The first element of the array is an object representing [Transaction]{@link google.spanner.v1.Transaction}.
743
- * Please see the
744
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
745
- * for more details and examples.
746
- * @example
747
- * const [response] = await client.beginTransaction(request);
748
- */
749
401
  beginTransaction(request, optionsOrCallback, callback) {
750
402
  request = request || {};
751
403
  let options;
@@ -766,58 +418,6 @@ class SpannerClient {
766
418
  this.initialize();
767
419
  return this.innerApiCalls.beginTransaction(request, options, callback);
768
420
  }
769
- /**
770
- * Commits a transaction. The request includes the mutations to be
771
- * applied to rows in the database.
772
- *
773
- * `Commit` might return an `ABORTED` error. This can occur at any time;
774
- * commonly, the cause is conflicts with concurrent
775
- * transactions. However, it can also happen for a variety of other
776
- * reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
777
- * the transaction from the beginning, re-using the same session.
778
- *
779
- * On very rare occasions, `Commit` might return `UNKNOWN`. This can happen,
780
- * for example, if the client job experiences a 1+ hour networking failure.
781
- * At that point, Cloud Spanner has lost track of the transaction outcome and
782
- * we recommend that you perform another read from the database to see the
783
- * state of things as they are now.
784
- *
785
- * @param {Object} request
786
- * The request object that will be sent.
787
- * @param {string} request.session
788
- * Required. The session in which the transaction to be committed is running.
789
- * @param {Buffer} request.transactionId
790
- * Commit a previously-started transaction.
791
- * @param {google.spanner.v1.TransactionOptions} request.singleUseTransaction
792
- * Execute mutations in a temporary transaction. Note that unlike
793
- * commit of a previously-started transaction, commit with a
794
- * temporary transaction is non-idempotent. That is, if the
795
- * `CommitRequest` is sent to Cloud Spanner more than once (for
796
- * instance, due to retries in the application, or in the
797
- * transport library), it is possible that the mutations are
798
- * executed more than once. If this is undesirable, use
799
- * {@link google.spanner.v1.Spanner.BeginTransaction|BeginTransaction} and
800
- * {@link google.spanner.v1.Spanner.Commit|Commit} instead.
801
- * @param {number[]} request.mutations
802
- * The mutations to be executed when this transaction commits. All
803
- * mutations are applied atomically, in the order they appear in
804
- * this list.
805
- * @param {boolean} request.returnCommitStats
806
- * If `true`, then statistics related to the transaction will be included in
807
- * the {@link google.spanner.v1.CommitResponse.commit_stats|CommitResponse}. Default value is
808
- * `false`.
809
- * @param {google.spanner.v1.RequestOptions} request.requestOptions
810
- * Common options for this request.
811
- * @param {object} [options]
812
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
813
- * @returns {Promise} - The promise which resolves to an array.
814
- * The first element of the array is an object representing [CommitResponse]{@link google.spanner.v1.CommitResponse}.
815
- * Please see the
816
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
817
- * for more details and examples.
818
- * @example
819
- * const [response] = await client.commit(request);
820
- */
821
421
  commit(request, optionsOrCallback, callback) {
822
422
  request = request || {};
823
423
  let options;
@@ -838,32 +438,6 @@ class SpannerClient {
838
438
  this.initialize();
839
439
  return this.innerApiCalls.commit(request, options, callback);
840
440
  }
841
- /**
842
- * Rolls back a transaction, releasing any locks it holds. It is a good
843
- * idea to call this for any transaction that includes one or more
844
- * {@link google.spanner.v1.Spanner.Read|Read} or {@link google.spanner.v1.Spanner.ExecuteSql|ExecuteSql} requests and
845
- * ultimately decides not to commit.
846
- *
847
- * `Rollback` returns `OK` if it successfully aborts the transaction, the
848
- * transaction was already aborted, or the transaction is not
849
- * found. `Rollback` never returns `ABORTED`.
850
- *
851
- * @param {Object} request
852
- * The request object that will be sent.
853
- * @param {string} request.session
854
- * Required. The session in which the transaction to roll back is running.
855
- * @param {Buffer} request.transactionId
856
- * Required. The transaction to roll back.
857
- * @param {object} [options]
858
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
859
- * @returns {Promise} - The promise which resolves to an array.
860
- * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
861
- * Please see the
862
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
863
- * for more details and examples.
864
- * @example
865
- * const [response] = await client.rollback(request);
866
- */
867
441
  rollback(request, optionsOrCallback, callback) {
868
442
  request = request || {};
869
443
  let options;
@@ -884,71 +458,6 @@ class SpannerClient {
884
458
  this.initialize();
885
459
  return this.innerApiCalls.rollback(request, options, callback);
886
460
  }
887
- /**
888
- * Creates a set of partition tokens that can be used to execute a query
889
- * operation in parallel. Each of the returned partition tokens can be used
890
- * by {@link google.spanner.v1.Spanner.ExecuteStreamingSql|ExecuteStreamingSql} to specify a subset
891
- * of the query result to read. The same session and read-only transaction
892
- * must be used by the PartitionQueryRequest used to create the
893
- * partition tokens and the ExecuteSqlRequests that use the partition tokens.
894
- *
895
- * Partition tokens become invalid when the session used to create them
896
- * is deleted, is idle for too long, begins a new transaction, or becomes too
897
- * old. When any of these happen, it is not possible to resume the query, and
898
- * the whole operation must be restarted from the beginning.
899
- *
900
- * @param {Object} request
901
- * The request object that will be sent.
902
- * @param {string} request.session
903
- * Required. The session used to create the partitions.
904
- * @param {google.spanner.v1.TransactionSelector} request.transaction
905
- * Read only snapshot transactions are supported, read/write and single use
906
- * transactions are not.
907
- * @param {string} request.sql
908
- * Required. The query request to generate partitions for. The request will fail if
909
- * the query is not root partitionable. The query plan of a root
910
- * partitionable query has a single distributed union operator. A distributed
911
- * union operator conceptually divides one or more tables into multiple
912
- * splits, remotely evaluates a subquery independently on each split, and
913
- * then unions all results.
914
- *
915
- * This must not contain DML commands, such as INSERT, UPDATE, or
916
- * DELETE. Use {@link google.spanner.v1.Spanner.ExecuteStreamingSql|ExecuteStreamingSql} with a
917
- * PartitionedDml transaction for large, partition-friendly DML operations.
918
- * @param {google.protobuf.Struct} request.params
919
- * Parameter names and values that bind to placeholders in the SQL string.
920
- *
921
- * A parameter placeholder consists of the `@` character followed by the
922
- * parameter name (for example, `@firstName`). Parameter names can contain
923
- * letters, numbers, and underscores.
924
- *
925
- * Parameters can appear anywhere that a literal value is expected. The same
926
- * parameter name can be used more than once, for example:
927
- *
928
- * `"WHERE id > @msg_id AND id < @msg_id + 100"`
929
- *
930
- * It is an error to execute a SQL statement with unbound parameters.
931
- * @param {number[]} request.paramTypes
932
- * It is not always possible for Cloud Spanner to infer the right SQL type
933
- * from a JSON value. For example, values of type `BYTES` and values
934
- * of type `STRING` both appear in {@link google.spanner.v1.PartitionQueryRequest.params|params} as JSON strings.
935
- *
936
- * In these cases, `param_types` can be used to specify the exact
937
- * SQL type for some or all of the SQL query parameters. See the
938
- * definition of {@link google.spanner.v1.Type|Type} for more information
939
- * about SQL types.
940
- * @param {google.spanner.v1.PartitionOptions} request.partitionOptions
941
- * Additional options that affect how many partitions are created.
942
- * @param {object} [options]
943
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
944
- * @returns {Promise} - The promise which resolves to an array.
945
- * The first element of the array is an object representing [PartitionResponse]{@link google.spanner.v1.PartitionResponse}.
946
- * Please see the
947
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
948
- * for more details and examples.
949
- * @example
950
- * const [response] = await client.partitionQuery(request);
951
- */
952
461
  partitionQuery(request, optionsOrCallback, callback) {
953
462
  request = request || {};
954
463
  let options;
@@ -969,57 +478,6 @@ class SpannerClient {
969
478
  this.initialize();
970
479
  return this.innerApiCalls.partitionQuery(request, options, callback);
971
480
  }
972
- /**
973
- * Creates a set of partition tokens that can be used to execute a read
974
- * operation in parallel. Each of the returned partition tokens can be used
975
- * by {@link google.spanner.v1.Spanner.StreamingRead|StreamingRead} to specify a subset of the read
976
- * result to read. The same session and read-only transaction must be used by
977
- * the PartitionReadRequest used to create the partition tokens and the
978
- * ReadRequests that use the partition tokens. There are no ordering
979
- * guarantees on rows returned among the returned partition tokens, or even
980
- * within each individual StreamingRead call issued with a partition_token.
981
- *
982
- * Partition tokens become invalid when the session used to create them
983
- * is deleted, is idle for too long, begins a new transaction, or becomes too
984
- * old. When any of these happen, it is not possible to resume the read, and
985
- * the whole operation must be restarted from the beginning.
986
- *
987
- * @param {Object} request
988
- * The request object that will be sent.
989
- * @param {string} request.session
990
- * Required. The session used to create the partitions.
991
- * @param {google.spanner.v1.TransactionSelector} request.transaction
992
- * Read only snapshot transactions are supported, read/write and single use
993
- * transactions are not.
994
- * @param {string} request.table
995
- * Required. The name of the table in the database to be read.
996
- * @param {string} request.index
997
- * If non-empty, the name of an index on {@link google.spanner.v1.PartitionReadRequest.table|table}. This index is
998
- * used instead of the table primary key when interpreting {@link google.spanner.v1.PartitionReadRequest.key_set|key_set}
999
- * and sorting result rows. See {@link google.spanner.v1.PartitionReadRequest.key_set|key_set} for further information.
1000
- * @param {string[]} request.columns
1001
- * The columns of {@link google.spanner.v1.PartitionReadRequest.table|table} to be returned for each row matching
1002
- * this request.
1003
- * @param {google.spanner.v1.KeySet} request.keySet
1004
- * Required. `key_set` identifies the rows to be yielded. `key_set` names the
1005
- * primary keys of the rows in {@link google.spanner.v1.PartitionReadRequest.table|table} to be yielded, unless {@link google.spanner.v1.PartitionReadRequest.index|index}
1006
- * is present. If {@link google.spanner.v1.PartitionReadRequest.index|index} is present, then {@link google.spanner.v1.PartitionReadRequest.key_set|key_set} instead names
1007
- * index keys in {@link google.spanner.v1.PartitionReadRequest.index|index}.
1008
- *
1009
- * It is not an error for the `key_set` to name rows that do not
1010
- * exist in the database. Read yields nothing for nonexistent rows.
1011
- * @param {google.spanner.v1.PartitionOptions} request.partitionOptions
1012
- * Additional options that affect how many partitions are created.
1013
- * @param {object} [options]
1014
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1015
- * @returns {Promise} - The promise which resolves to an array.
1016
- * The first element of the array is an object representing [PartitionResponse]{@link google.spanner.v1.PartitionResponse}.
1017
- * Please see the
1018
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
1019
- * for more details and examples.
1020
- * @example
1021
- * const [response] = await client.partitionRead(request);
1022
- */
1023
481
  partitionRead(request, optionsOrCallback, callback) {
1024
482
  request = request || {};
1025
483
  let options;
@@ -1125,10 +583,8 @@ class SpannerClient {
1125
583
  * Please see the
1126
584
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
1127
585
  * for more details and examples.
1128
- * @example
1129
- * const stream = client.executeStreamingSql(request);
1130
- * stream.on('data', (response) => { ... });
1131
- * stream.on('end', () => { ... });
586
+ * @example <caption>include:samples/generated/v1/spanner.execute_streaming_sql.js</caption>
587
+ * region_tag:spanner_v1_generated_Spanner_ExecuteStreamingSql_async
1132
588
  */
1133
589
  executeStreamingSql(request, options) {
1134
590
  request = request || {};
@@ -1203,10 +659,8 @@ class SpannerClient {
1203
659
  * Please see the
1204
660
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
1205
661
  * for more details and examples.
1206
- * @example
1207
- * const stream = client.streamingRead(request);
1208
- * stream.on('data', (response) => { ... });
1209
- * stream.on('end', () => { ... });
662
+ * @example <caption>include:samples/generated/v1/spanner.streaming_read.js</caption>
663
+ * region_tag:spanner_v1_generated_Spanner_StreamingRead_async
1210
664
  */
1211
665
  streamingRead(request, options) {
1212
666
  request = request || {};
@@ -1220,44 +674,6 @@ class SpannerClient {
1220
674
  this.initialize();
1221
675
  return this.innerApiCalls.streamingRead(request, options);
1222
676
  }
1223
- /**
1224
- * Lists all sessions in a given database.
1225
- *
1226
- * @param {Object} request
1227
- * The request object that will be sent.
1228
- * @param {string} request.database
1229
- * Required. The database in which to list sessions.
1230
- * @param {number} request.pageSize
1231
- * Number of sessions to be returned in the response. If 0 or less, defaults
1232
- * to the server's maximum allowed page size.
1233
- * @param {string} request.pageToken
1234
- * If non-empty, `page_token` should contain a
1235
- * {@link google.spanner.v1.ListSessionsResponse.next_page_token|next_page_token} from a previous
1236
- * {@link google.spanner.v1.ListSessionsResponse|ListSessionsResponse}.
1237
- * @param {string} request.filter
1238
- * An expression for filtering the results of the request. Filter rules are
1239
- * case insensitive. The fields eligible for filtering are:
1240
- *
1241
- * * `labels.key` where key is the name of a label
1242
- *
1243
- * Some examples of using filters are:
1244
- *
1245
- * * `labels.env:*` --> The session has the label "env".
1246
- * * `labels.env:dev` --> The session has the label "env" and the value of
1247
- * the label contains the string "dev".
1248
- * @param {object} [options]
1249
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1250
- * @returns {Promise} - The promise which resolves to an array.
1251
- * The first element of the array is Array of [Session]{@link google.spanner.v1.Session}.
1252
- * The client library will perform auto-pagination by default: it will call the API as many
1253
- * times as needed and will merge results from all the pages into this array.
1254
- * Note that it can affect your quota.
1255
- * We recommend using `listSessionsAsync()`
1256
- * method described below for async iteration which you can stop as needed.
1257
- * Please see the
1258
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1259
- * for more details and examples.
1260
- */
1261
677
  listSessions(request, optionsOrCallback, callback) {
1262
678
  request = request || {};
1263
679
  let options;
@@ -1323,7 +739,8 @@ class SpannerClient {
1323
739
  gax.routingHeader.fromParams({
1324
740
  database: request.database || '',
1325
741
  });
1326
- const callSettings = new gax.CallSettings(options);
742
+ const defaultCallSettings = this._defaults['listSessions'];
743
+ const callSettings = defaultCallSettings.merge(options);
1327
744
  this.initialize();
1328
745
  return this.descriptors.page.listSessions.createStream(this.innerApiCalls.listSessions, request, callSettings);
1329
746
  }
@@ -1363,11 +780,8 @@ class SpannerClient {
1363
780
  * Please see the
1364
781
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1365
782
  * for more details and examples.
1366
- * @example
1367
- * const iterable = client.listSessionsAsync(request);
1368
- * for await (const response of iterable) {
1369
- * // process response
1370
- * }
783
+ * @example <caption>include:samples/generated/v1/spanner.list_sessions.js</caption>
784
+ * region_tag:spanner_v1_generated_Spanner_ListSessions_async
1371
785
  */
1372
786
  listSessionsAsync(request, options) {
1373
787
  request = request || {};
@@ -1378,8 +792,8 @@ class SpannerClient {
1378
792
  gax.routingHeader.fromParams({
1379
793
  database: request.database || '',
1380
794
  });
1381
- options = options || {};
1382
- const callSettings = new gax.CallSettings(options);
795
+ const defaultCallSettings = this._defaults['listSessions'];
796
+ const callSettings = defaultCallSettings.merge(options);
1383
797
  this.initialize();
1384
798
  return this.descriptors.page.listSessions.asyncIterate(this.innerApiCalls['listSessions'], request, callSettings);
1385
799
  }