@google-cloud/spanner 7.21.0 → 8.1.0
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.
- package/README.md +2 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +1 -1
- package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +1 -1
- package/build/protos/google/spanner/admin/database/v1/common.proto +1 -1
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +36 -1
- package/build/protos/google/spanner/admin/instance/v1/common.proto +1 -1
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +1 -1
- package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1 -1
- package/build/protos/google/spanner/v1/change_stream.proto +451 -0
- package/build/protos/google/spanner/v1/commit_response.proto +10 -5
- package/build/protos/google/spanner/v1/keys.proto +1 -1
- package/build/protos/google/spanner/v1/mutation.proto +1 -1
- package/build/protos/google/spanner/v1/query_plan.proto +1 -1
- package/build/protos/google/spanner/v1/result_set.proto +55 -49
- package/build/protos/google/spanner/v1/spanner.proto +1 -1
- package/build/protos/google/spanner/v1/transaction.proto +41 -357
- package/build/protos/google/spanner/v1/type.proto +1 -1
- package/build/protos/protos.d.ts +1577 -194
- package/build/protos/protos.js +3977 -288
- package/build/protos/protos.json +325 -3
- package/build/src/backup.js +7 -0
- package/build/src/batch-transaction.d.ts +48 -29
- package/build/src/batch-transaction.js +15 -100
- package/build/src/codec.js +63 -47
- package/build/src/common-grpc/service-object.js +1 -0
- package/build/src/common-grpc/service.js +35 -18
- package/build/src/common.d.ts +1 -0
- package/build/src/common.js +9 -1
- package/build/src/database.d.ts +1 -0
- package/build/src/database.js +54 -42
- package/build/src/helper.d.ts +99 -0
- package/build/src/helper.js +178 -0
- package/build/src/index.d.ts +33 -0
- package/build/src/index.js +202 -21
- package/build/src/instance-config.d.ts +1 -1
- package/build/src/instance-config.js +4 -0
- package/build/src/instance.js +12 -6
- package/build/src/instrument.js +5 -6
- package/build/src/metrics/constants.d.ts +36 -0
- package/build/src/metrics/constants.js +106 -0
- package/build/src/metrics/external-types.d.ts +20 -0
- package/build/src/metrics/external-types.js +32 -0
- package/build/src/metrics/interceptor.d.ts +13 -0
- package/build/src/metrics/interceptor.js +87 -0
- package/build/src/metrics/metrics-tracer-factory.d.ts +165 -0
- package/build/src/metrics/metrics-tracer-factory.js +389 -0
- package/build/src/metrics/metrics-tracer.d.ts +204 -0
- package/build/src/metrics/metrics-tracer.js +371 -0
- package/build/src/metrics/spanner-metrics-exporter.d.ts +35 -0
- package/build/src/metrics/spanner-metrics-exporter.js +119 -0
- package/build/src/metrics/transform.d.ts +144 -0
- package/build/src/metrics/transform.js +272 -0
- package/build/src/multiplexed-session.js +7 -1
- package/build/src/partial-result-stream.js +18 -10
- package/build/src/request_id_header.js +1 -0
- package/build/src/session-factory.d.ts +34 -0
- package/build/src/session-factory.js +35 -2
- package/build/src/session-pool.js +24 -8
- package/build/src/session.d.ts +0 -1
- package/build/src/session.js +7 -2
- package/build/src/table.js +6 -3
- package/build/src/transaction-runner.d.ts +1 -0
- package/build/src/transaction-runner.js +18 -2
- package/build/src/transaction.d.ts +42 -1
- package/build/src/transaction.js +258 -94
- package/build/src/v1/database_admin_client.d.ts +37 -2
- package/build/src/v1/database_admin_client.js +718 -168
- package/build/src/v1/database_admin_client_config.json +4 -0
- package/build/src/v1/instance_admin_client.d.ts +122 -1
- package/build/src/v1/instance_admin_client.js +765 -146
- package/build/src/v1/spanner_client.d.ts +2 -1
- package/build/src/v1/spanner_client.js +391 -85
- package/build/src/v1/spanner_executor_proxy_client.d.ts +2 -1
- package/build/src/v1/spanner_executor_proxy_client.js +41 -19
- package/build/src/v1/spanner_proto_list.json +1 -0
- package/package.json +64 -58
package/build/protos/protos.json
CHANGED
|
@@ -3034,6 +3034,18 @@
|
|
|
3034
3034
|
"(google.api.method_signature)": "parent"
|
|
3035
3035
|
}
|
|
3036
3036
|
]
|
|
3037
|
+
},
|
|
3038
|
+
"InternalUpdateGraphOperation": {
|
|
3039
|
+
"requestType": "InternalUpdateGraphOperationRequest",
|
|
3040
|
+
"responseType": "InternalUpdateGraphOperationResponse",
|
|
3041
|
+
"options": {
|
|
3042
|
+
"(google.api.method_signature)": "database,operation_id"
|
|
3043
|
+
},
|
|
3044
|
+
"parsedOptions": [
|
|
3045
|
+
{
|
|
3046
|
+
"(google.api.method_signature)": "database,operation_id"
|
|
3047
|
+
}
|
|
3048
|
+
]
|
|
3037
3049
|
}
|
|
3038
3050
|
}
|
|
3039
3051
|
},
|
|
@@ -3322,6 +3334,13 @@
|
|
|
3322
3334
|
"options": {
|
|
3323
3335
|
"(google.api.field_behavior)": "OPTIONAL"
|
|
3324
3336
|
}
|
|
3337
|
+
},
|
|
3338
|
+
"throughputMode": {
|
|
3339
|
+
"type": "bool",
|
|
3340
|
+
"id": 5,
|
|
3341
|
+
"options": {
|
|
3342
|
+
"(google.api.field_behavior)": "OPTIONAL"
|
|
3343
|
+
}
|
|
3325
3344
|
}
|
|
3326
3345
|
}
|
|
3327
3346
|
},
|
|
@@ -3708,6 +3727,49 @@
|
|
|
3708
3727
|
}
|
|
3709
3728
|
}
|
|
3710
3729
|
}
|
|
3730
|
+
},
|
|
3731
|
+
"InternalUpdateGraphOperationRequest": {
|
|
3732
|
+
"fields": {
|
|
3733
|
+
"database": {
|
|
3734
|
+
"type": "string",
|
|
3735
|
+
"id": 1,
|
|
3736
|
+
"options": {
|
|
3737
|
+
"(google.api.field_behavior)": "REQUIRED",
|
|
3738
|
+
"(google.api.resource_reference).type": "spanner.googleapis.com/Database"
|
|
3739
|
+
}
|
|
3740
|
+
},
|
|
3741
|
+
"operationId": {
|
|
3742
|
+
"type": "string",
|
|
3743
|
+
"id": 2,
|
|
3744
|
+
"options": {
|
|
3745
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
3746
|
+
}
|
|
3747
|
+
},
|
|
3748
|
+
"vmIdentityToken": {
|
|
3749
|
+
"type": "string",
|
|
3750
|
+
"id": 5,
|
|
3751
|
+
"options": {
|
|
3752
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
3753
|
+
}
|
|
3754
|
+
},
|
|
3755
|
+
"progress": {
|
|
3756
|
+
"type": "double",
|
|
3757
|
+
"id": 3,
|
|
3758
|
+
"options": {
|
|
3759
|
+
"(google.api.field_behavior)": "OPTIONAL"
|
|
3760
|
+
}
|
|
3761
|
+
},
|
|
3762
|
+
"status": {
|
|
3763
|
+
"type": "google.rpc.Status",
|
|
3764
|
+
"id": 6,
|
|
3765
|
+
"options": {
|
|
3766
|
+
"(google.api.field_behavior)": "OPTIONAL"
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
},
|
|
3771
|
+
"InternalUpdateGraphOperationResponse": {
|
|
3772
|
+
"fields": {}
|
|
3711
3773
|
}
|
|
3712
3774
|
}
|
|
3713
3775
|
}
|
|
@@ -7668,13 +7730,12 @@
|
|
|
7668
7730
|
"csharp_namespace": "Google.Cloud.Spanner.V1",
|
|
7669
7731
|
"go_package": "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb",
|
|
7670
7732
|
"java_multiple_files": true,
|
|
7671
|
-
"java_outer_classname": "
|
|
7733
|
+
"java_outer_classname": "ChangeStreamProto",
|
|
7672
7734
|
"java_package": "com.google.spanner.v1",
|
|
7673
7735
|
"php_namespace": "Google\\Cloud\\Spanner\\V1",
|
|
7674
7736
|
"ruby_package": "Google::Cloud::Spanner::V1",
|
|
7675
7737
|
"(google.api.resource_definition).type": "spanner.googleapis.com/Database",
|
|
7676
|
-
"(google.api.resource_definition).pattern": "projects/{project}/instances/{instance}/databases/{database}"
|
|
7677
|
-
"cc_enable_arenas": true
|
|
7738
|
+
"(google.api.resource_definition).pattern": "projects/{project}/instances/{instance}/databases/{database}"
|
|
7678
7739
|
},
|
|
7679
7740
|
"nested": {
|
|
7680
7741
|
"Spanner": {
|
|
@@ -8800,6 +8861,10 @@
|
|
|
8800
8861
|
"precommitToken": {
|
|
8801
8862
|
"type": "MultiplexedSessionPrecommitToken",
|
|
8802
8863
|
"id": 4
|
|
8864
|
+
},
|
|
8865
|
+
"snapshotTimestamp": {
|
|
8866
|
+
"type": "google.protobuf.Timestamp",
|
|
8867
|
+
"id": 5
|
|
8803
8868
|
}
|
|
8804
8869
|
},
|
|
8805
8870
|
"nested": {
|
|
@@ -9155,6 +9220,13 @@
|
|
|
9155
9220
|
"options": {
|
|
9156
9221
|
"(google.api.field_behavior)": "OPTIONAL"
|
|
9157
9222
|
}
|
|
9223
|
+
},
|
|
9224
|
+
"last": {
|
|
9225
|
+
"type": "bool",
|
|
9226
|
+
"id": 9,
|
|
9227
|
+
"options": {
|
|
9228
|
+
"(google.api.field_behavior)": "OPTIONAL"
|
|
9229
|
+
}
|
|
9158
9230
|
}
|
|
9159
9231
|
}
|
|
9160
9232
|
},
|
|
@@ -9360,6 +9432,256 @@
|
|
|
9360
9432
|
"PG_JSONB": 3,
|
|
9361
9433
|
"PG_OID": 4
|
|
9362
9434
|
}
|
|
9435
|
+
},
|
|
9436
|
+
"ChangeStreamRecord": {
|
|
9437
|
+
"oneofs": {
|
|
9438
|
+
"record": {
|
|
9439
|
+
"oneof": [
|
|
9440
|
+
"dataChangeRecord",
|
|
9441
|
+
"heartbeatRecord",
|
|
9442
|
+
"partitionStartRecord",
|
|
9443
|
+
"partitionEndRecord",
|
|
9444
|
+
"partitionEventRecord"
|
|
9445
|
+
]
|
|
9446
|
+
}
|
|
9447
|
+
},
|
|
9448
|
+
"fields": {
|
|
9449
|
+
"dataChangeRecord": {
|
|
9450
|
+
"type": "DataChangeRecord",
|
|
9451
|
+
"id": 1
|
|
9452
|
+
},
|
|
9453
|
+
"heartbeatRecord": {
|
|
9454
|
+
"type": "HeartbeatRecord",
|
|
9455
|
+
"id": 2
|
|
9456
|
+
},
|
|
9457
|
+
"partitionStartRecord": {
|
|
9458
|
+
"type": "PartitionStartRecord",
|
|
9459
|
+
"id": 3
|
|
9460
|
+
},
|
|
9461
|
+
"partitionEndRecord": {
|
|
9462
|
+
"type": "PartitionEndRecord",
|
|
9463
|
+
"id": 4
|
|
9464
|
+
},
|
|
9465
|
+
"partitionEventRecord": {
|
|
9466
|
+
"type": "PartitionEventRecord",
|
|
9467
|
+
"id": 5
|
|
9468
|
+
}
|
|
9469
|
+
},
|
|
9470
|
+
"nested": {
|
|
9471
|
+
"DataChangeRecord": {
|
|
9472
|
+
"fields": {
|
|
9473
|
+
"commitTimestamp": {
|
|
9474
|
+
"type": "google.protobuf.Timestamp",
|
|
9475
|
+
"id": 1
|
|
9476
|
+
},
|
|
9477
|
+
"recordSequence": {
|
|
9478
|
+
"type": "string",
|
|
9479
|
+
"id": 2
|
|
9480
|
+
},
|
|
9481
|
+
"serverTransactionId": {
|
|
9482
|
+
"type": "string",
|
|
9483
|
+
"id": 3
|
|
9484
|
+
},
|
|
9485
|
+
"isLastRecordInTransactionInPartition": {
|
|
9486
|
+
"type": "bool",
|
|
9487
|
+
"id": 4
|
|
9488
|
+
},
|
|
9489
|
+
"table": {
|
|
9490
|
+
"type": "string",
|
|
9491
|
+
"id": 5
|
|
9492
|
+
},
|
|
9493
|
+
"columnMetadata": {
|
|
9494
|
+
"rule": "repeated",
|
|
9495
|
+
"type": "ColumnMetadata",
|
|
9496
|
+
"id": 6
|
|
9497
|
+
},
|
|
9498
|
+
"mods": {
|
|
9499
|
+
"rule": "repeated",
|
|
9500
|
+
"type": "Mod",
|
|
9501
|
+
"id": 7
|
|
9502
|
+
},
|
|
9503
|
+
"modType": {
|
|
9504
|
+
"type": "ModType",
|
|
9505
|
+
"id": 8
|
|
9506
|
+
},
|
|
9507
|
+
"valueCaptureType": {
|
|
9508
|
+
"type": "ValueCaptureType",
|
|
9509
|
+
"id": 9
|
|
9510
|
+
},
|
|
9511
|
+
"numberOfRecordsInTransaction": {
|
|
9512
|
+
"type": "int32",
|
|
9513
|
+
"id": 10
|
|
9514
|
+
},
|
|
9515
|
+
"numberOfPartitionsInTransaction": {
|
|
9516
|
+
"type": "int32",
|
|
9517
|
+
"id": 11
|
|
9518
|
+
},
|
|
9519
|
+
"transactionTag": {
|
|
9520
|
+
"type": "string",
|
|
9521
|
+
"id": 12
|
|
9522
|
+
},
|
|
9523
|
+
"isSystemTransaction": {
|
|
9524
|
+
"type": "bool",
|
|
9525
|
+
"id": 13
|
|
9526
|
+
}
|
|
9527
|
+
},
|
|
9528
|
+
"nested": {
|
|
9529
|
+
"ColumnMetadata": {
|
|
9530
|
+
"fields": {
|
|
9531
|
+
"name": {
|
|
9532
|
+
"type": "string",
|
|
9533
|
+
"id": 1
|
|
9534
|
+
},
|
|
9535
|
+
"type": {
|
|
9536
|
+
"type": "Type",
|
|
9537
|
+
"id": 2
|
|
9538
|
+
},
|
|
9539
|
+
"isPrimaryKey": {
|
|
9540
|
+
"type": "bool",
|
|
9541
|
+
"id": 3
|
|
9542
|
+
},
|
|
9543
|
+
"ordinalPosition": {
|
|
9544
|
+
"type": "int64",
|
|
9545
|
+
"id": 4
|
|
9546
|
+
}
|
|
9547
|
+
}
|
|
9548
|
+
},
|
|
9549
|
+
"ModValue": {
|
|
9550
|
+
"fields": {
|
|
9551
|
+
"columnMetadataIndex": {
|
|
9552
|
+
"type": "int32",
|
|
9553
|
+
"id": 1
|
|
9554
|
+
},
|
|
9555
|
+
"value": {
|
|
9556
|
+
"type": "google.protobuf.Value",
|
|
9557
|
+
"id": 2
|
|
9558
|
+
}
|
|
9559
|
+
}
|
|
9560
|
+
},
|
|
9561
|
+
"Mod": {
|
|
9562
|
+
"fields": {
|
|
9563
|
+
"keys": {
|
|
9564
|
+
"rule": "repeated",
|
|
9565
|
+
"type": "ModValue",
|
|
9566
|
+
"id": 1
|
|
9567
|
+
},
|
|
9568
|
+
"oldValues": {
|
|
9569
|
+
"rule": "repeated",
|
|
9570
|
+
"type": "ModValue",
|
|
9571
|
+
"id": 2
|
|
9572
|
+
},
|
|
9573
|
+
"newValues": {
|
|
9574
|
+
"rule": "repeated",
|
|
9575
|
+
"type": "ModValue",
|
|
9576
|
+
"id": 3
|
|
9577
|
+
}
|
|
9578
|
+
}
|
|
9579
|
+
},
|
|
9580
|
+
"ModType": {
|
|
9581
|
+
"values": {
|
|
9582
|
+
"MOD_TYPE_UNSPECIFIED": 0,
|
|
9583
|
+
"INSERT": 10,
|
|
9584
|
+
"UPDATE": 20,
|
|
9585
|
+
"DELETE": 30
|
|
9586
|
+
}
|
|
9587
|
+
},
|
|
9588
|
+
"ValueCaptureType": {
|
|
9589
|
+
"values": {
|
|
9590
|
+
"VALUE_CAPTURE_TYPE_UNSPECIFIED": 0,
|
|
9591
|
+
"OLD_AND_NEW_VALUES": 10,
|
|
9592
|
+
"NEW_VALUES": 20,
|
|
9593
|
+
"NEW_ROW": 30,
|
|
9594
|
+
"NEW_ROW_AND_OLD_VALUES": 40
|
|
9595
|
+
}
|
|
9596
|
+
}
|
|
9597
|
+
}
|
|
9598
|
+
},
|
|
9599
|
+
"HeartbeatRecord": {
|
|
9600
|
+
"fields": {
|
|
9601
|
+
"timestamp": {
|
|
9602
|
+
"type": "google.protobuf.Timestamp",
|
|
9603
|
+
"id": 1
|
|
9604
|
+
}
|
|
9605
|
+
}
|
|
9606
|
+
},
|
|
9607
|
+
"PartitionStartRecord": {
|
|
9608
|
+
"fields": {
|
|
9609
|
+
"startTimestamp": {
|
|
9610
|
+
"type": "google.protobuf.Timestamp",
|
|
9611
|
+
"id": 1
|
|
9612
|
+
},
|
|
9613
|
+
"recordSequence": {
|
|
9614
|
+
"type": "string",
|
|
9615
|
+
"id": 2
|
|
9616
|
+
},
|
|
9617
|
+
"partitionTokens": {
|
|
9618
|
+
"rule": "repeated",
|
|
9619
|
+
"type": "string",
|
|
9620
|
+
"id": 3
|
|
9621
|
+
}
|
|
9622
|
+
}
|
|
9623
|
+
},
|
|
9624
|
+
"PartitionEndRecord": {
|
|
9625
|
+
"fields": {
|
|
9626
|
+
"endTimestamp": {
|
|
9627
|
+
"type": "google.protobuf.Timestamp",
|
|
9628
|
+
"id": 1
|
|
9629
|
+
},
|
|
9630
|
+
"recordSequence": {
|
|
9631
|
+
"type": "string",
|
|
9632
|
+
"id": 2
|
|
9633
|
+
},
|
|
9634
|
+
"partitionToken": {
|
|
9635
|
+
"type": "string",
|
|
9636
|
+
"id": 3
|
|
9637
|
+
}
|
|
9638
|
+
}
|
|
9639
|
+
},
|
|
9640
|
+
"PartitionEventRecord": {
|
|
9641
|
+
"fields": {
|
|
9642
|
+
"commitTimestamp": {
|
|
9643
|
+
"type": "google.protobuf.Timestamp",
|
|
9644
|
+
"id": 1
|
|
9645
|
+
},
|
|
9646
|
+
"recordSequence": {
|
|
9647
|
+
"type": "string",
|
|
9648
|
+
"id": 2
|
|
9649
|
+
},
|
|
9650
|
+
"partitionToken": {
|
|
9651
|
+
"type": "string",
|
|
9652
|
+
"id": 3
|
|
9653
|
+
},
|
|
9654
|
+
"moveInEvents": {
|
|
9655
|
+
"rule": "repeated",
|
|
9656
|
+
"type": "MoveInEvent",
|
|
9657
|
+
"id": 4
|
|
9658
|
+
},
|
|
9659
|
+
"moveOutEvents": {
|
|
9660
|
+
"rule": "repeated",
|
|
9661
|
+
"type": "MoveOutEvent",
|
|
9662
|
+
"id": 5
|
|
9663
|
+
}
|
|
9664
|
+
},
|
|
9665
|
+
"nested": {
|
|
9666
|
+
"MoveInEvent": {
|
|
9667
|
+
"fields": {
|
|
9668
|
+
"sourcePartitionToken": {
|
|
9669
|
+
"type": "string",
|
|
9670
|
+
"id": 1
|
|
9671
|
+
}
|
|
9672
|
+
}
|
|
9673
|
+
},
|
|
9674
|
+
"MoveOutEvent": {
|
|
9675
|
+
"fields": {
|
|
9676
|
+
"destinationPartitionToken": {
|
|
9677
|
+
"type": "string",
|
|
9678
|
+
"id": 1
|
|
9679
|
+
}
|
|
9680
|
+
}
|
|
9681
|
+
}
|
|
9682
|
+
}
|
|
9683
|
+
}
|
|
9684
|
+
}
|
|
9363
9685
|
}
|
|
9364
9686
|
}
|
|
9365
9687
|
}
|
package/build/src/backup.js
CHANGED
|
@@ -45,6 +45,13 @@ const precise_date_1 = require("@google-cloud/precise-date");
|
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
47
|
class Backup {
|
|
48
|
+
id;
|
|
49
|
+
formattedName_;
|
|
50
|
+
instanceFormattedName_;
|
|
51
|
+
resourceHeader_;
|
|
52
|
+
request;
|
|
53
|
+
metadata;
|
|
54
|
+
sourceName;
|
|
48
55
|
constructor(instance, name, sourceName) {
|
|
49
56
|
this.request = instance.request;
|
|
50
57
|
this.instanceFormattedName_ = instance.formattedName_;
|
|
@@ -13,14 +13,25 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Snapshot } from './transaction';
|
|
16
|
+
import { ExecuteSqlRequest, ReadCallback, ReadRequest, ReadResponse, RunCallback, RunResponse, Snapshot } from './transaction';
|
|
17
17
|
import { google } from '../protos/protos';
|
|
18
18
|
import { Session } from '.';
|
|
19
|
+
import { ResourceCallback } from '../src/common';
|
|
19
20
|
export interface TransactionIdentifier {
|
|
20
21
|
session: string | Session;
|
|
21
22
|
transaction?: string;
|
|
22
23
|
timestamp?: google.protobuf.ITimestamp;
|
|
23
24
|
}
|
|
25
|
+
export type CreateReadPartitionsResponse = [
|
|
26
|
+
ReadRequest[],
|
|
27
|
+
google.spanner.v1.IPartitionResponse
|
|
28
|
+
];
|
|
29
|
+
export type CreateReadPartitionsCallback = ResourceCallback<ReadRequest[], google.spanner.v1.IPartitionResponse>;
|
|
30
|
+
export type CreateQueryPartitionsResponse = [
|
|
31
|
+
ExecuteSqlRequest[],
|
|
32
|
+
google.spanner.v1.IPartitionResponse
|
|
33
|
+
];
|
|
34
|
+
export type CreateQueryPartitionsCallback = ResourceCallback<ExecuteSqlRequest[], google.spanner.v1.IPartitionResponse>;
|
|
24
35
|
/**
|
|
25
36
|
* Use a BatchTransaction object to create partitions and read/query against
|
|
26
37
|
* your Cloud Spanner database.
|
|
@@ -75,17 +86,17 @@ declare class BatchTransaction extends Snapshot {
|
|
|
75
86
|
/**
|
|
76
87
|
* @see [`ExecuteSqlRequest`](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.ExecuteSqlRequest)
|
|
77
88
|
* @typedef {object} QueryPartition
|
|
78
|
-
* @property {string} partitionToken
|
|
89
|
+
* @property {string} partitionToken A token representing the partition, used to identify and execute the partition at a later time.
|
|
79
90
|
*/
|
|
80
91
|
/**
|
|
81
92
|
* @typedef {array} CreateQueryPartitionsResponse
|
|
82
|
-
* @property {
|
|
93
|
+
* @property {ExecuteSqlRequest[]} 0 Array of ExecuteSqlRequest partitions.
|
|
83
94
|
* @property {object} 1 The full API response.
|
|
84
95
|
*/
|
|
85
96
|
/**
|
|
86
97
|
* @callback CreateQueryPartitionsCallback
|
|
87
98
|
* @param {?Error} err Request error, if any.
|
|
88
|
-
* @param {
|
|
99
|
+
* @param {ExecuteSqlRequest[]} partitions Array of ExecuteSqlRequest partitions.
|
|
89
100
|
* @param {object} apiResponse The full API response.
|
|
90
101
|
*/
|
|
91
102
|
/**
|
|
@@ -93,22 +104,23 @@ declare class BatchTransaction extends Snapshot {
|
|
|
93
104
|
* operation in parallel. Partitions become invalid when the transaction used
|
|
94
105
|
* to create them is closed.
|
|
95
106
|
*
|
|
96
|
-
* @param {string|
|
|
97
|
-
*
|
|
98
|
-
* object.
|
|
107
|
+
* @param {string|ExecuteSqlRequest} query - A SQL query string or an {@link ExecuteSqlRequest} object.
|
|
108
|
+
* If a string is provided, it will be wrapped into an `ExecuteSqlRequest`.
|
|
99
109
|
* @param {object} [query.gaxOptions] Request configuration options,
|
|
100
110
|
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
101
111
|
* for more details.
|
|
102
112
|
* @param {object} [query.params] A map of parameter name to values.
|
|
103
113
|
* @param {object} [query.partitionOptions] A map of partition options.
|
|
104
114
|
* @param {object} [query.types] A map of parameter types.
|
|
105
|
-
* @param {CreateQueryPartitionsCallback} [callback] Callback
|
|
106
|
-
* @returns {Promise<CreateQueryPartitionsResponse
|
|
115
|
+
* @param {CreateQueryPartitionsCallback} [callback] - Optional Callback function. If not provided, a promise is returned.
|
|
116
|
+
* @returns {Promise<CreateQueryPartitionsResponse>|void} A promise resolving to an array of
|
|
117
|
+
* `ExecuteSqlRequest' partitions and `IPartitionResponse` , or void if a callback is provided.
|
|
107
118
|
*
|
|
108
119
|
* @example <caption>include:samples/batch.js</caption>
|
|
109
120
|
* region_tag:spanner_batch_client
|
|
110
121
|
*/
|
|
111
|
-
createQueryPartitions(query:
|
|
122
|
+
createQueryPartitions(query: string | ExecuteSqlRequest): Promise<CreateQueryPartitionsResponse>;
|
|
123
|
+
createQueryPartitions(query: string | ExecuteSqlRequest, callback: CreateQueryPartitionsCallback): void;
|
|
112
124
|
protected getDBName(): string;
|
|
113
125
|
/**
|
|
114
126
|
* Generic create partition method. Handles common parameters used in both
|
|
@@ -124,20 +136,20 @@ declare class BatchTransaction extends Snapshot {
|
|
|
124
136
|
/**
|
|
125
137
|
* @typedef {object} ReadPartition
|
|
126
138
|
* @mixes ReadRequestOptions
|
|
127
|
-
* @property {string} partitionToken
|
|
128
|
-
* @property {object} [gaxOptions]
|
|
129
|
-
*
|
|
139
|
+
* @property {string} partitionToken partitionToken A token representing the partition, used to identify and execute the partition at a later time.
|
|
140
|
+
* @property {object} [gaxOptions] optional request configuration options,
|
|
141
|
+
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
130
142
|
* for more details.
|
|
131
143
|
*/
|
|
132
144
|
/**
|
|
133
145
|
* @typedef {array} CreateReadPartitionsResponse
|
|
134
|
-
* @property {ReadPartition[]} 0
|
|
146
|
+
* @property {ReadPartition[]} 0 Array of read partitions.
|
|
135
147
|
* @property {object} 1 The full API response.
|
|
136
148
|
*/
|
|
137
149
|
/**
|
|
138
150
|
* @callback CreateReadPartitionsCallback
|
|
139
151
|
* @param {?Error} err Request error, if any.
|
|
140
|
-
* @param {ReadPartition[]} partitions
|
|
152
|
+
* @param {ReadPartition[]} partitions Array of read partitions.
|
|
141
153
|
* @param {object} apiResponse The full API response.
|
|
142
154
|
*/
|
|
143
155
|
/**
|
|
@@ -145,30 +157,37 @@ declare class BatchTransaction extends Snapshot {
|
|
|
145
157
|
* operation in parallel. Partitions become invalid when the transaction used
|
|
146
158
|
* to create them is closed.
|
|
147
159
|
*
|
|
148
|
-
* @param {
|
|
160
|
+
* @param {ReadRequest} options Configuration object, describing what to
|
|
149
161
|
* read from.
|
|
150
162
|
* @param {CreateReadPartitionsCallback} [callback] Callback function.
|
|
151
|
-
* @returns {Promise<CreateReadPartitionsResponse
|
|
163
|
+
* @returns {Promise<CreateReadPartitionsResponse>|void} A promise that resolves
|
|
164
|
+
* to an array containing the read partitions and the full API response, or `void` if a callback is provided.
|
|
152
165
|
*/
|
|
153
|
-
createReadPartitions(options:
|
|
166
|
+
createReadPartitions(options: ReadRequest): Promise<CreateReadPartitionsResponse>;
|
|
167
|
+
createReadPartitions(options: ReadRequest, callback: CreateReadPartitionsCallback): void;
|
|
154
168
|
/**
|
|
155
|
-
* Executes partition.
|
|
169
|
+
* Executes partition using either a read or a SQL query, depending on the type of partition provided.
|
|
156
170
|
*
|
|
157
|
-
* @
|
|
158
|
-
*
|
|
171
|
+
* @param {ReadRequest|ExecuteSqlRequest} partition The partition object to execute.
|
|
172
|
+
* This can either be a `ReadPartition` or a `QueryPartition`.
|
|
159
173
|
*
|
|
160
|
-
* @param {
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* @
|
|
165
|
-
*
|
|
166
|
-
* @
|
|
174
|
+
* @param {ReadCallback|RunCallback} [callback] Optional Callback function. If not provided,
|
|
175
|
+
* a promise will be returned.
|
|
176
|
+
*
|
|
177
|
+
* If the partition is a read partition, it will execute a read using {@link Transaction#read}
|
|
178
|
+
* @see {@link Transaction#read} when using {@link ReadRequest}.
|
|
179
|
+
*
|
|
180
|
+
* If the partition is query partition, it will execute a SQL query using {@link Transaction#run}
|
|
181
|
+
* @see {@link Transaction#run} when using {@link ExecuteSqlRequest}.
|
|
182
|
+
*
|
|
183
|
+
* @returns {Promise<ReadResponse | RunResponse>|void} Returns a promise when no callback is provided,
|
|
184
|
+
* or void when a callback is used.
|
|
167
185
|
*
|
|
168
186
|
* @example <caption>include:samples/batch.js</caption>
|
|
169
187
|
* region_tag:spanner_batch_execute_partitions
|
|
170
188
|
*/
|
|
171
|
-
execute(partition:
|
|
189
|
+
execute(partition: ReadRequest | ExecuteSqlRequest): Promise<ReadResponse | RunResponse>;
|
|
190
|
+
execute(partition: ReadRequest | ExecuteSqlRequest, callback: ReadCallback | RunCallback): void;
|
|
172
191
|
/**
|
|
173
192
|
* Executes partition in streaming mode.
|
|
174
193
|
*
|