@google-cloud/spanner 7.18.0 → 7.19.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/CHANGELOG.md +30 -0
- package/README.md +1 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +773 -0
- package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
- package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1279 -0
- package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2110 -0
- package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1520 -0
- package/build/protos/google/spanner/v1/commit_response.proto +59 -0
- package/build/protos/google/spanner/v1/keys.proto +163 -0
- package/build/protos/google/spanner/v1/mutation.proto +107 -0
- package/build/protos/google/spanner/v1/query_plan.proto +128 -0
- package/build/protos/google/spanner/v1/result_set.proto +237 -0
- package/build/protos/google/spanner/v1/spanner.proto +1389 -0
- package/build/protos/google/spanner/v1/transaction.proto +622 -0
- package/build/protos/google/spanner/v1/type.proto +214 -0
- package/build/protos/protos.d.ts +39869 -0
- package/build/protos/protos.js +101659 -0
- package/build/protos/protos.json +10391 -0
- package/build/src/backup.d.ts +349 -0
- package/build/src/backup.js +246 -0
- package/build/src/batch-transaction.d.ts +247 -0
- package/build/src/batch-transaction.js +384 -0
- package/build/src/codec.d.ts +362 -0
- package/build/src/codec.js +791 -0
- package/build/src/common-grpc/service-object.d.ts +80 -0
- package/build/src/common-grpc/service-object.js +101 -0
- package/build/src/common-grpc/service.d.ts +445 -0
- package/build/src/common-grpc/service.js +826 -0
- package/build/src/common.d.ts +66 -0
- package/build/src/common.js +54 -0
- package/build/src/database.d.ts +2103 -0
- package/build/src/database.js +1660 -0
- package/build/src/extra_proto_list.json +1 -0
- package/build/src/helper.d.ts +45 -0
- package/build/src/helper.js +71 -0
- package/build/src/index.d.ts +1195 -0
- package/build/src/index.js +1059 -0
- package/build/src/instance-config.d.ts +294 -0
- package/build/src/instance-config.js +216 -0
- package/build/src/instance.d.ts +832 -0
- package/build/src/instance.js +781 -0
- package/build/src/instrument.d.ts +85 -0
- package/build/src/instrument.js +215 -0
- package/build/src/multiplexed-session.d.ts +135 -0
- package/build/src/multiplexed-session.js +194 -0
- package/build/src/partial-result-stream.d.ts +253 -0
- package/build/src/partial-result-stream.js +400 -0
- package/build/src/request_id_header.d.ts +41 -0
- package/build/src/request_id_header.js +138 -0
- package/build/src/session-factory.d.ts +115 -0
- package/build/src/session-factory.js +106 -0
- package/build/src/session-pool.d.ts +471 -0
- package/build/src/session-pool.js +765 -0
- package/build/src/session.d.ts +258 -0
- package/build/src/session.js +348 -0
- package/build/src/spanner_grpc_config.json +92 -0
- package/build/src/table.d.ts +831 -0
- package/build/src/table.js +277 -0
- package/build/src/transaction-runner.d.ts +185 -0
- package/build/src/transaction-runner.js +282 -0
- package/build/src/transaction.d.ts +1691 -0
- package/build/src/transaction.js +2003 -0
- package/build/src/v1/database_admin_client.d.ts +2332 -0
- package/build/src/v1/database_admin_client.js +2364 -0
- package/build/src/v1/database_admin_client_config.json +165 -0
- package/build/src/v1/database_admin_proto_list.json +6 -0
- package/build/src/v1/gapic_metadata.json +27 -0
- package/build/src/v1/index.d.ts +4 -0
- package/build/src/v1/index.js +29 -0
- package/build/src/v1/instance_admin_client.d.ts +1985 -0
- package/build/src/v1/instance_admin_client.js +1768 -0
- package/build/src/v1/instance_admin_client_config.json +129 -0
- package/build/src/v1/instance_admin_proto_list.json +4 -0
- package/build/src/v1/spanner_client.d.ts +1250 -0
- package/build/src/v1/spanner_client.js +1086 -0
- package/build/src/v1/spanner_client_config.json +119 -0
- package/build/src/v1/spanner_executor_proxy_client.d.ts +418 -0
- package/build/src/v1/spanner_executor_proxy_client.js +706 -0
- package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
- package/build/src/v1/spanner_executor_proxy_proto_list.json +14 -0
- package/build/src/v1/spanner_proto_list.json +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,831 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2016 Google Inc. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Operation as GaxOperation, CallOptions } from 'google-gax';
|
|
17
|
+
import { Database, UpdateSchemaCallback, UpdateSchemaResponse } from './database';
|
|
18
|
+
import { PartialResultStream } from './partial-result-stream';
|
|
19
|
+
import { ReadRequest, TimestampBounds, CommitOptions, CommitResponse, ReadResponse, ReadCallback, CommitCallback } from './transaction';
|
|
20
|
+
import { google as databaseAdmin } from '../protos/protos';
|
|
21
|
+
import { Schema, LongRunningCallback } from './common';
|
|
22
|
+
import IRequestOptions = databaseAdmin.spanner.v1.IRequestOptions;
|
|
23
|
+
import { ObservabilityOptions } from './instrument';
|
|
24
|
+
export type Key = string | string[];
|
|
25
|
+
export type CreateTableResponse = [
|
|
26
|
+
Table,
|
|
27
|
+
GaxOperation,
|
|
28
|
+
databaseAdmin.longrunning.IOperation
|
|
29
|
+
];
|
|
30
|
+
export type CreateTableCallback = LongRunningCallback<Table>;
|
|
31
|
+
export type DropTableResponse = UpdateSchemaResponse;
|
|
32
|
+
export type DropTableCallback = UpdateSchemaCallback;
|
|
33
|
+
interface MutateRowsOptions extends CommitOptions {
|
|
34
|
+
requestOptions?: Omit<IRequestOptions, 'requestTag'>;
|
|
35
|
+
excludeTxnFromChangeStreams?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type DeleteRowsCallback = CommitCallback;
|
|
38
|
+
export type DeleteRowsResponse = CommitResponse;
|
|
39
|
+
export type DeleteRowsOptions = MutateRowsOptions;
|
|
40
|
+
export type InsertRowsCallback = CommitCallback;
|
|
41
|
+
export type InsertRowsResponse = CommitResponse;
|
|
42
|
+
export type InsertRowsOptions = MutateRowsOptions;
|
|
43
|
+
export type ReplaceRowsCallback = CommitCallback;
|
|
44
|
+
export type ReplaceRowsResponse = CommitResponse;
|
|
45
|
+
export type ReplaceRowsOptions = MutateRowsOptions;
|
|
46
|
+
export type UpdateRowsCallback = CommitCallback;
|
|
47
|
+
export type UpdateRowsResponse = CommitResponse;
|
|
48
|
+
export type UpdateRowsOptions = MutateRowsOptions;
|
|
49
|
+
export type UpsertRowsCallback = CommitCallback;
|
|
50
|
+
export type UpsertRowsResponse = CommitResponse;
|
|
51
|
+
export type UpsertRowsOptions = MutateRowsOptions;
|
|
52
|
+
/**
|
|
53
|
+
* Create a Table object to interact with a table in a Cloud Spanner
|
|
54
|
+
* database.
|
|
55
|
+
*
|
|
56
|
+
* @class
|
|
57
|
+
*
|
|
58
|
+
* @param {Database} database {@link Database} instance.
|
|
59
|
+
* @param {string} name Name of the table.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```
|
|
63
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
64
|
+
* const spanner = new Spanner();
|
|
65
|
+
*
|
|
66
|
+
* const instance = spanner.instance('my-instance');
|
|
67
|
+
* const database = instance.database('my-database');
|
|
68
|
+
* const table = database.table('my-table');
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare class Table {
|
|
72
|
+
database: Database;
|
|
73
|
+
name: string;
|
|
74
|
+
_observabilityOptions?: ObservabilityOptions;
|
|
75
|
+
constructor(database: Database, name: string);
|
|
76
|
+
/**
|
|
77
|
+
* Create a table.
|
|
78
|
+
*
|
|
79
|
+
* @param {string} schema See {@link Database#createTable}.
|
|
80
|
+
* @param {object} [gaxOptions]
|
|
81
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
82
|
+
* for more details.
|
|
83
|
+
* @param {CreateTableCallback} [callback] Callback function.
|
|
84
|
+
* @returns {Promise<CreateTableResponse>}
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```
|
|
88
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
89
|
+
* const spanner = new Spanner();
|
|
90
|
+
*
|
|
91
|
+
* const instance = spanner.instance('my-instance');
|
|
92
|
+
* const database = instance.database('my-database');
|
|
93
|
+
* const table = database.table('Singers');
|
|
94
|
+
*
|
|
95
|
+
* const schema =
|
|
96
|
+
* 'CREATE TABLE Singers (' +
|
|
97
|
+
* ' SingerId INT64 NOT NULL,' +
|
|
98
|
+
* ' FirstName STRING(1024),' +
|
|
99
|
+
* ' LastName STRING(1024),' +
|
|
100
|
+
* ' SingerInfo BYTES(MAX),' +
|
|
101
|
+
* ') PRIMARY KEY(SingerId)';
|
|
102
|
+
*
|
|
103
|
+
* table.create(schema, function(err, table, operation, apiResponse) {
|
|
104
|
+
* if (err) {
|
|
105
|
+
* // Error handling omitted.
|
|
106
|
+
* }
|
|
107
|
+
*
|
|
108
|
+
* operation
|
|
109
|
+
* .on('error', function(err) {})
|
|
110
|
+
* .on('complete', function() {
|
|
111
|
+
* // Table created successfully.
|
|
112
|
+
* });
|
|
113
|
+
* });
|
|
114
|
+
*
|
|
115
|
+
* //-
|
|
116
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
117
|
+
* //-
|
|
118
|
+
* table.create(schema)
|
|
119
|
+
* .then(function(data) {
|
|
120
|
+
* const table = data[0];
|
|
121
|
+
* const operation = data[1];
|
|
122
|
+
*
|
|
123
|
+
* return operation.promise();
|
|
124
|
+
* })
|
|
125
|
+
* .then(function() {
|
|
126
|
+
* // Table created successfully.
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
create(schema: Schema, gaxOptions?: CallOptions): Promise<CreateTableResponse>;
|
|
131
|
+
create(schema: Schema, callback: CreateTableCallback): void;
|
|
132
|
+
create(schema: Schema, gaxOptions: CallOptions, callback: CreateTableCallback): void;
|
|
133
|
+
protected getDBName(): string;
|
|
134
|
+
/**
|
|
135
|
+
* Create a readable object stream to receive rows from the database using key
|
|
136
|
+
* lookups and scans.
|
|
137
|
+
*
|
|
138
|
+
* @see [StreamingRead API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.StreamingRead)
|
|
139
|
+
* @see [ReadRequest API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.ReadRequest)
|
|
140
|
+
*
|
|
141
|
+
* @param {ReadRequest} query Configuration object, describing what to read from the table..
|
|
142
|
+
* @param {TimestampBounds} [options] [Transaction options](https://cloud.google.com/spanner/docs/timestamp-bounds).
|
|
143
|
+
* @returns {PartialResultStream} A readable stream that emits rows.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```
|
|
147
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
148
|
+
* const spanner = new Spanner();
|
|
149
|
+
*
|
|
150
|
+
* const instance = spanner.instance('my-instance');
|
|
151
|
+
* const database = instance.database('my-database');
|
|
152
|
+
* const table = database.table('Singers');
|
|
153
|
+
*
|
|
154
|
+
* table.createReadStream({
|
|
155
|
+
* keys: ['1'],
|
|
156
|
+
* columns: ['SingerId', 'name']
|
|
157
|
+
* })
|
|
158
|
+
* .on('error', function(err) {})
|
|
159
|
+
* .on('data', function(row) {
|
|
160
|
+
* // row = {
|
|
161
|
+
* // SingerId: '1',
|
|
162
|
+
* // Name: 'Eddie Wilson'
|
|
163
|
+
* // }
|
|
164
|
+
* })
|
|
165
|
+
* .on('end', function() {
|
|
166
|
+
* // All results retrieved.
|
|
167
|
+
* });
|
|
168
|
+
*
|
|
169
|
+
* //-
|
|
170
|
+
* // Provide an array for `query.keys` to read with a composite key.
|
|
171
|
+
* //-
|
|
172
|
+
* const query = {
|
|
173
|
+
* keys: [
|
|
174
|
+
* [
|
|
175
|
+
* 'Id1',
|
|
176
|
+
* 'Name1'
|
|
177
|
+
* ],
|
|
178
|
+
* [
|
|
179
|
+
* 'Id2',
|
|
180
|
+
* 'Name2'
|
|
181
|
+
* ]
|
|
182
|
+
* ],
|
|
183
|
+
* // ...
|
|
184
|
+
* };
|
|
185
|
+
*
|
|
186
|
+
* //-
|
|
187
|
+
* // If you anticipate many results, you can end a stream early to prevent
|
|
188
|
+
* // unnecessary processing and API requests.
|
|
189
|
+
* //-
|
|
190
|
+
* table.createReadStream({
|
|
191
|
+
* keys: ['1'],
|
|
192
|
+
* columns: ['SingerId', 'name']
|
|
193
|
+
* })
|
|
194
|
+
* .on('data', function(row) {
|
|
195
|
+
* this.end();
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
createReadStream(request: ReadRequest, options?: TimestampBounds): PartialResultStream;
|
|
200
|
+
/**
|
|
201
|
+
* @typedef {array} DropTableResponse
|
|
202
|
+
* @property {google.longrunning.Operation} 0 An {@link Operation} object that can be used to check
|
|
203
|
+
* the status of the request.
|
|
204
|
+
* @property {object} 1 The full API response.
|
|
205
|
+
*/
|
|
206
|
+
/**
|
|
207
|
+
* @callback DropTableCallback
|
|
208
|
+
* @param {?Error} err Request error, if any.
|
|
209
|
+
* @param {google.longrunning.Operation} operation An {@link Operation} object that can be used to
|
|
210
|
+
* check the status of the request.
|
|
211
|
+
* @param {object} apiResponse The full API response.
|
|
212
|
+
*/
|
|
213
|
+
/**
|
|
214
|
+
* Delete the table. Not to be confused with {@link Table#deleteRows}.
|
|
215
|
+
*
|
|
216
|
+
* Wrapper around {@link Database#updateSchema}.
|
|
217
|
+
*
|
|
218
|
+
* @see {@link Database#updateSchema}
|
|
219
|
+
*
|
|
220
|
+
* @throws {TypeError} If any arguments are passed in.
|
|
221
|
+
* @param {object} [gaxOptions]
|
|
222
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
223
|
+
* for more details.
|
|
224
|
+
* @param {DropTableCallback} [callback] Callback function.
|
|
225
|
+
* @returns {Promise<DropTableResponse>}
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```
|
|
229
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
230
|
+
* const spanner = new Spanner();
|
|
231
|
+
*
|
|
232
|
+
* const instance = spanner.instance('my-instance');
|
|
233
|
+
* const database = instance.database('my-database');
|
|
234
|
+
* const table = database.table('Singers');
|
|
235
|
+
*
|
|
236
|
+
* table.delete(function(err, operation, apiResponse) {
|
|
237
|
+
* if (err) {
|
|
238
|
+
* // Error handling omitted.
|
|
239
|
+
* }
|
|
240
|
+
*
|
|
241
|
+
* operation
|
|
242
|
+
* .on('error', function(err) {})
|
|
243
|
+
* .on('complete', function() {
|
|
244
|
+
* // Table deleted successfully.
|
|
245
|
+
* });
|
|
246
|
+
* });
|
|
247
|
+
*
|
|
248
|
+
* //-
|
|
249
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
250
|
+
* //-
|
|
251
|
+
* table.delete()
|
|
252
|
+
* .then(function(data) {
|
|
253
|
+
* const operation = data[0];
|
|
254
|
+
* return operation.promise();
|
|
255
|
+
* })
|
|
256
|
+
* .then(function() {
|
|
257
|
+
* // Table deleted successfully.
|
|
258
|
+
* });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
delete(gaxOptions?: CallOptions): Promise<DropTableResponse>;
|
|
262
|
+
delete(callback: DropTableCallback): void;
|
|
263
|
+
delete(gaxOptions: CallOptions, callback: DropTableCallback): void;
|
|
264
|
+
/**
|
|
265
|
+
* @typedef {array} DeleteRowsResponse
|
|
266
|
+
* @property {CommitResponse} 0 The commit response.
|
|
267
|
+
*/
|
|
268
|
+
/**
|
|
269
|
+
* @callback DeleteRowsCallback
|
|
270
|
+
* @param {?Error} error Request error, if any.
|
|
271
|
+
* @param {CommitResponse} apiResponse The full API response.
|
|
272
|
+
*/
|
|
273
|
+
/**
|
|
274
|
+
* @typedef {object} DeleteRowsOptions
|
|
275
|
+
* @property {google.spanner.v1.IRequestOptions} requestOptions The request options to include
|
|
276
|
+
* with the commit request.
|
|
277
|
+
* @property {boolean} returnCommitStats Include statistics related to the
|
|
278
|
+
* transaction in the {@link CommitResponse}.
|
|
279
|
+
* @property {object} [gaxOptions]
|
|
280
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
281
|
+
* for more details.
|
|
282
|
+
*/
|
|
283
|
+
/**
|
|
284
|
+
* Delete rows from this table.
|
|
285
|
+
*
|
|
286
|
+
* @see [Commit API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.Commit)
|
|
287
|
+
*
|
|
288
|
+
* @param {array} keys The keys for the rows to delete. If using a
|
|
289
|
+
* composite key, provide an array within this array. See the example
|
|
290
|
+
* below.
|
|
291
|
+
* @param {DeleteRowsOptions|CallOptions} [options] Options for configuring the request.
|
|
292
|
+
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
293
|
+
* for more details.
|
|
294
|
+
* @param {DeleteRowsCallback} [callback] Callback function.
|
|
295
|
+
* @returns {Promise<DeleteRowsResponse>}
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```
|
|
299
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
300
|
+
* const spanner = new Spanner();
|
|
301
|
+
*
|
|
302
|
+
* const instance = spanner.instance('my-instance');
|
|
303
|
+
* const database = instance.database('my-database');
|
|
304
|
+
* const table = database.table('Singers');
|
|
305
|
+
*
|
|
306
|
+
* const keys = ['Id1', 'Id2', 'Id3'];
|
|
307
|
+
*
|
|
308
|
+
* table.deleteRows(keys, function(err, apiResponse) {});
|
|
309
|
+
*
|
|
310
|
+
* //-
|
|
311
|
+
* // Provide an array for `keys` to delete rows with a composite key.
|
|
312
|
+
* //-
|
|
313
|
+
* const keys = [
|
|
314
|
+
* [
|
|
315
|
+
* 'Id1',
|
|
316
|
+
* 'Name1'
|
|
317
|
+
* ],
|
|
318
|
+
* [
|
|
319
|
+
* 'Id2',
|
|
320
|
+
* 'Name2'
|
|
321
|
+
* ]
|
|
322
|
+
* ];
|
|
323
|
+
*
|
|
324
|
+
* //-
|
|
325
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
326
|
+
* //-
|
|
327
|
+
* table.deleteRows(keys)
|
|
328
|
+
* .then(function(data) {
|
|
329
|
+
* const apiResponse = data[0];
|
|
330
|
+
* });
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
deleteRows(keys: Key[], options?: DeleteRowsOptions | CallOptions): Promise<DeleteRowsResponse>;
|
|
334
|
+
deleteRows(keys: Key[], callback: DeleteRowsCallback): void;
|
|
335
|
+
deleteRows(keys: Key[], options: DeleteRowsOptions | CallOptions, callback: DeleteRowsCallback): void;
|
|
336
|
+
/**
|
|
337
|
+
* Drop the table.
|
|
338
|
+
*
|
|
339
|
+
* @see {@link Table#delete}
|
|
340
|
+
* @see {@link Database#updateSchema}
|
|
341
|
+
*
|
|
342
|
+
* @param {object} [gaxOptions] Request configuration options.
|
|
343
|
+
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
344
|
+
* for more details.
|
|
345
|
+
* @param {DropTableCallback} [callback] Callback function.
|
|
346
|
+
* @returns {Promise<DropTableResponse>}
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```
|
|
350
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
351
|
+
* const spanner = new Spanner();
|
|
352
|
+
*
|
|
353
|
+
* const instance = spanner.instance('my-instance');
|
|
354
|
+
* const database = instance.database('my-database');
|
|
355
|
+
* const table = database.table('Singers');
|
|
356
|
+
*
|
|
357
|
+
* table.drop(function(err, operation, apiResponse) {
|
|
358
|
+
* if (err) {
|
|
359
|
+
* // Error handling omitted.
|
|
360
|
+
* }
|
|
361
|
+
*
|
|
362
|
+
* operation
|
|
363
|
+
* .on('error', function(err) {})
|
|
364
|
+
* .on('complete', function() {
|
|
365
|
+
* // Table dropped successfully.
|
|
366
|
+
* });
|
|
367
|
+
* });
|
|
368
|
+
*
|
|
369
|
+
* //-
|
|
370
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
371
|
+
* //-
|
|
372
|
+
* table.drop()
|
|
373
|
+
* .then(function(data) {
|
|
374
|
+
* const operation = data[0];
|
|
375
|
+
* return operation.promise();
|
|
376
|
+
* })
|
|
377
|
+
* .then(function() {
|
|
378
|
+
* // Table dropped successfully.
|
|
379
|
+
* });
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
drop(gaxOptions?: CallOptions): Promise<DropTableResponse>;
|
|
383
|
+
drop(callback: DropTableCallback): void;
|
|
384
|
+
drop(gaxOptions: CallOptions, callback: DropTableCallback): void;
|
|
385
|
+
/**
|
|
386
|
+
* @typedef {array} InsertRowsResponse
|
|
387
|
+
* @property {CommitResponse} 0 The commit response.
|
|
388
|
+
*/
|
|
389
|
+
/**
|
|
390
|
+
* @callback InsertRowsCallback
|
|
391
|
+
* @param {?Error} error Request error, if any.
|
|
392
|
+
* @param {CommitResponse} apiResponse The full API response.
|
|
393
|
+
*/
|
|
394
|
+
/**
|
|
395
|
+
* @typedef {object} InsertRowsOptions
|
|
396
|
+
* @property {google.spanner.v1.IRequestOptions} requestOptions The request options to include
|
|
397
|
+
* with the commit request.
|
|
398
|
+
* @property {boolean} returnCommitStats Include statistics related to the
|
|
399
|
+
* transaction in the {@link CommitResponse}.
|
|
400
|
+
* @property {object} [gaxOptions]
|
|
401
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
402
|
+
* for more details.
|
|
403
|
+
*/
|
|
404
|
+
/**
|
|
405
|
+
* Insert rows of data into this table.
|
|
406
|
+
*
|
|
407
|
+
* @see [Commit API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.Commit)
|
|
408
|
+
*
|
|
409
|
+
* @param {object|object[]} rows A map of names to values of data to insert
|
|
410
|
+
* into this table.
|
|
411
|
+
* @param {InsertRowsOptions|CallOptions} [options] Options for configuring the request.
|
|
412
|
+
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
413
|
+
* for more details.
|
|
414
|
+
* @param {InsertRowsCallback} [callback] Callback function.
|
|
415
|
+
* @returns {Promise<InsertRowsResponse>}
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```
|
|
419
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
420
|
+
* const spanner = new Spanner();
|
|
421
|
+
*
|
|
422
|
+
* const instance = spanner.instance('my-instance');
|
|
423
|
+
* const database = instance.database('my-database');
|
|
424
|
+
* const table = database.table('Singers');
|
|
425
|
+
*
|
|
426
|
+
* const row = {
|
|
427
|
+
* SingerId: 'Id3',
|
|
428
|
+
* Name: 'Eddie Wilson'
|
|
429
|
+
* };
|
|
430
|
+
*
|
|
431
|
+
* table.insert(row, function(err, apiResponse) {
|
|
432
|
+
* if (err) {
|
|
433
|
+
* // Error handling omitted.
|
|
434
|
+
* }
|
|
435
|
+
*
|
|
436
|
+
* // Rows inserted successfully.
|
|
437
|
+
* });
|
|
438
|
+
*
|
|
439
|
+
* //-
|
|
440
|
+
* // Multiple rows can be inserted at once.
|
|
441
|
+
* //-
|
|
442
|
+
* const row2 = {
|
|
443
|
+
* SingerId: 'Id3b',
|
|
444
|
+
* Name: 'Joe West'
|
|
445
|
+
* };
|
|
446
|
+
*
|
|
447
|
+
* table.insert([
|
|
448
|
+
* row,
|
|
449
|
+
* row2
|
|
450
|
+
* ], function(err, apiResponse) {});
|
|
451
|
+
*
|
|
452
|
+
* //-
|
|
453
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
454
|
+
* //-
|
|
455
|
+
* table.insert(row)
|
|
456
|
+
* .then(function(data) {
|
|
457
|
+
* const apiResponse = data[0];
|
|
458
|
+
* });
|
|
459
|
+
*
|
|
460
|
+
* ```
|
|
461
|
+
* @example <caption>include:samples/crud.js</caption>
|
|
462
|
+
* region_tag:spanner_insert_data
|
|
463
|
+
* Full example:
|
|
464
|
+
*/
|
|
465
|
+
insert(rows: object | object[], options?: InsertRowsOptions | CallOptions): Promise<InsertRowsResponse>;
|
|
466
|
+
insert(rows: object | object[], callback: InsertRowsCallback): void;
|
|
467
|
+
insert(rows: object | object[], options: InsertRowsOptions | CallOptions, callback: InsertRowsCallback): void;
|
|
468
|
+
/**
|
|
469
|
+
* Configuration object, describing what to read from the table.
|
|
470
|
+
*/
|
|
471
|
+
/**
|
|
472
|
+
* @typedef {array} TableReadResponse
|
|
473
|
+
* @property {array[]} 0 Rows are returned as an array of object arrays. Each
|
|
474
|
+
* object has a `name` and `value` property. To get a serialized object,
|
|
475
|
+
* call `toJSON()`. Optionally, provide an options object to `toJSON()`
|
|
476
|
+
* specifying `wrapNumbers: true` to protect large integer values outside
|
|
477
|
+
* of the range of JavaScript Number. If set, FLOAT64 values will be returned
|
|
478
|
+
* as {@link Spanner.Float} objects and INT64 values as {@link
|
|
479
|
+
* Spanner.Int}.
|
|
480
|
+
*/
|
|
481
|
+
/**
|
|
482
|
+
* @callback TableReadCallback
|
|
483
|
+
* @param {?Error} err Request error, if any.
|
|
484
|
+
* @param {array[]} rows Rows are returned as an array of object arrays. Each
|
|
485
|
+
* object has a `name` and `value` property. To get a serialized object,
|
|
486
|
+
* call `toJSON()`. Optionally, provide an options object to `toJSON()`
|
|
487
|
+
* specifying `wrapNumbers: true` to protect large integer values outside
|
|
488
|
+
* of the range of JavaScript Number. If set, FLOAT64 values will be returned
|
|
489
|
+
* as {@link Spanner.Float} objects and INT64 values as {@link
|
|
490
|
+
* Spanner.Int}.
|
|
491
|
+
*/
|
|
492
|
+
/**
|
|
493
|
+
* Receive rows from the database using key lookups and scans.
|
|
494
|
+
*
|
|
495
|
+
* **Performance Considerations:**
|
|
496
|
+
*
|
|
497
|
+
* This method wraps the streaming method,
|
|
498
|
+
* {@link Table#createReadStream} for your convenience. All rows will
|
|
499
|
+
* be stored in memory before being released to your callback. If you intend
|
|
500
|
+
* on receiving a lot of results from your query, consider using the streaming
|
|
501
|
+
* method, so you can free each result from memory after consuming it.
|
|
502
|
+
*
|
|
503
|
+
* @param {ReadRequest} query Configuration object, describing
|
|
504
|
+
* what to read from the table.
|
|
505
|
+
* @param {TimestampBounds} options [Transaction options](https://cloud.google.com/spanner/docs/timestamp-bounds).
|
|
506
|
+
* @param {TableReadCallback} [callback] Callback function.
|
|
507
|
+
* @returns {Promise<TableReadResponse>}
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* ```
|
|
511
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
512
|
+
* const spanner = new Spanner();
|
|
513
|
+
*
|
|
514
|
+
* const instance = spanner.instance('my-instance');
|
|
515
|
+
* const database = instance.database('my-database');
|
|
516
|
+
* const table = database.table('Singers');
|
|
517
|
+
*
|
|
518
|
+
* const query = {
|
|
519
|
+
* keys: ['1'],
|
|
520
|
+
* columns: ['SingerId', 'name']
|
|
521
|
+
* };
|
|
522
|
+
*
|
|
523
|
+
* table.read(query, function(err, rows) {
|
|
524
|
+
* if (err) {
|
|
525
|
+
* // Error handling omitted.
|
|
526
|
+
* }
|
|
527
|
+
*
|
|
528
|
+
* const firstRow = rows[0];
|
|
529
|
+
*
|
|
530
|
+
* // firstRow = [
|
|
531
|
+
* // {
|
|
532
|
+
* // name: 'SingerId',
|
|
533
|
+
* // value: '1'
|
|
534
|
+
* // },
|
|
535
|
+
* // {
|
|
536
|
+
* // name: 'Name',
|
|
537
|
+
* // value: 'Eddie Wilson'
|
|
538
|
+
* // }
|
|
539
|
+
* // ]
|
|
540
|
+
* });
|
|
541
|
+
*
|
|
542
|
+
* //-
|
|
543
|
+
* // Provide an array for `query.keys` to read with a composite key.
|
|
544
|
+
* //-
|
|
545
|
+
* const query = {
|
|
546
|
+
* keys: [
|
|
547
|
+
* [
|
|
548
|
+
* 'Id1',
|
|
549
|
+
* 'Name1'
|
|
550
|
+
* ],
|
|
551
|
+
* [
|
|
552
|
+
* 'Id2',
|
|
553
|
+
* 'Name2'
|
|
554
|
+
* ]
|
|
555
|
+
* ],
|
|
556
|
+
* // ...
|
|
557
|
+
* };
|
|
558
|
+
*
|
|
559
|
+
* //-
|
|
560
|
+
* // Rows are returned as an array of object arrays. Each object has a `name`
|
|
561
|
+
* // and `value` property. To get a serialized object, call `toJSON()`.
|
|
562
|
+
* //
|
|
563
|
+
* // Alternatively, set `query.json` to `true`, and this step will be
|
|
564
|
+
* performed
|
|
565
|
+
* // automatically.
|
|
566
|
+
* //-
|
|
567
|
+
* table.read(query, function(err, rows) {
|
|
568
|
+
* if (err) {
|
|
569
|
+
* // Error handling omitted.
|
|
570
|
+
* }
|
|
571
|
+
*
|
|
572
|
+
* const firstRow = rows[0];
|
|
573
|
+
*
|
|
574
|
+
* // firstRow.toJSON() = {
|
|
575
|
+
* // SingerId: '1',
|
|
576
|
+
* // Name: 'Eddie Wilson'
|
|
577
|
+
* // }
|
|
578
|
+
* });
|
|
579
|
+
*
|
|
580
|
+
* //-
|
|
581
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
582
|
+
* //-
|
|
583
|
+
* table.read(query)
|
|
584
|
+
* .then(function(data) {
|
|
585
|
+
* const rows = data[0];
|
|
586
|
+
* });
|
|
587
|
+
*
|
|
588
|
+
* ```
|
|
589
|
+
* @example <caption>include:samples/crud.js</caption>
|
|
590
|
+
* region_tag:spanner_read_data
|
|
591
|
+
* Full example:
|
|
592
|
+
*
|
|
593
|
+
* @example <caption>include:samples/crud.js</caption>
|
|
594
|
+
* region_tag:spanner_read_stale_data
|
|
595
|
+
* Reading stale data:
|
|
596
|
+
*
|
|
597
|
+
* @example <caption>include:samples/index-read-data.js</caption>
|
|
598
|
+
* region_tag:spanner_read_data_with_index
|
|
599
|
+
* Reading data using an index:
|
|
600
|
+
*
|
|
601
|
+
* @example <caption>include:samples/index-read-data-with-storing.js</caption>
|
|
602
|
+
* region_tag:spanner_read_data_with_storing_index
|
|
603
|
+
* Reading data using a storing index:
|
|
604
|
+
*/
|
|
605
|
+
read(request: ReadRequest, options?: TimestampBounds): Promise<ReadResponse>;
|
|
606
|
+
read(request: ReadRequest, callback: ReadCallback): void;
|
|
607
|
+
read(request: ReadRequest, options: TimestampBounds, callback: ReadCallback): void;
|
|
608
|
+
/**
|
|
609
|
+
* @typedef {array} ReplaceRowsResponse
|
|
610
|
+
* @property {CommitResponse} 0 The commit response.
|
|
611
|
+
*/
|
|
612
|
+
/**
|
|
613
|
+
* @callback ReplaceRowsCallback
|
|
614
|
+
* @param {?Error} error Request error, if any.
|
|
615
|
+
* @param {CommitResponse} apiResponse The full API response.
|
|
616
|
+
*/
|
|
617
|
+
/**
|
|
618
|
+
* @typedef {object} ReplaceRowsOptions
|
|
619
|
+
* @property {google.spanner.v1.IRequestOptions} requestOptions The request options to include
|
|
620
|
+
* with the commit request.
|
|
621
|
+
* @property {boolean} returnCommitStats Include statistics related to the
|
|
622
|
+
* transaction in the {@link CommitResponse}.
|
|
623
|
+
* @property {object} [gaxOptions]
|
|
624
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
625
|
+
* for more details.
|
|
626
|
+
*/
|
|
627
|
+
/**
|
|
628
|
+
* Replace rows of data within this table.
|
|
629
|
+
*
|
|
630
|
+
* @see [Commit API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.Commit)
|
|
631
|
+
*
|
|
632
|
+
* @param {object|object[]} rows A map of names to values of data to insert
|
|
633
|
+
* into this table.
|
|
634
|
+
* @param {ReplaceRowsOptions|CallOptions} [options] Options for configuring the request.
|
|
635
|
+
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
636
|
+
* for more details.
|
|
637
|
+
* @param {ReplaceRowsCallback} [callback] Callback function.
|
|
638
|
+
* @returns {Promise<ReplaceRowsResponse>}
|
|
639
|
+
*
|
|
640
|
+
* @example
|
|
641
|
+
* ```
|
|
642
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
643
|
+
* const spanner = new Spanner();
|
|
644
|
+
*
|
|
645
|
+
* const instance = spanner.instance('my-instance');
|
|
646
|
+
* const database = instance.database('my-database');
|
|
647
|
+
* const table = database.table('Singers');
|
|
648
|
+
*
|
|
649
|
+
* const row = {
|
|
650
|
+
* SingerId: 'Id3',
|
|
651
|
+
* Name: 'Joe West'
|
|
652
|
+
* };
|
|
653
|
+
*
|
|
654
|
+
* table.replace(row, function(err, apiResponse) {
|
|
655
|
+
* if (err) {
|
|
656
|
+
* // Error handling omitted.
|
|
657
|
+
* }
|
|
658
|
+
*
|
|
659
|
+
* // Row replaced successfully.
|
|
660
|
+
* });
|
|
661
|
+
*
|
|
662
|
+
* //-
|
|
663
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
664
|
+
* //-
|
|
665
|
+
* table.replace(row)
|
|
666
|
+
* .then(function(data) {
|
|
667
|
+
* const apiResponse = data[0];
|
|
668
|
+
* });
|
|
669
|
+
* ```
|
|
670
|
+
*/
|
|
671
|
+
replace(rows: object | object[], options?: ReplaceRowsOptions | CallOptions): Promise<ReplaceRowsResponse>;
|
|
672
|
+
replace(rows: object | object[], callback: ReplaceRowsCallback): void;
|
|
673
|
+
replace(rows: object | object[], options: ReplaceRowsOptions | CallOptions, callback: ReplaceRowsCallback): void;
|
|
674
|
+
/**
|
|
675
|
+
* @typedef {array} UpdateRowsResponse
|
|
676
|
+
* @property {CommitResponse} 0 The commit response.
|
|
677
|
+
*/
|
|
678
|
+
/**
|
|
679
|
+
* @callback UpdateRowsCallback
|
|
680
|
+
* @param {?Error} error Request error, if any.
|
|
681
|
+
* @param {CommitResponse} apiResponse The full API response.
|
|
682
|
+
*/
|
|
683
|
+
/**
|
|
684
|
+
* @typedef {object} UpdateRowsOptions
|
|
685
|
+
* @property {google.spanner.v1.IRequestOptions} requestOptions The request options to include
|
|
686
|
+
* with the commit request.
|
|
687
|
+
* @property {boolean} returnCommitStats Include statistics related to the
|
|
688
|
+
* transaction in the {@link CommitResponse}.
|
|
689
|
+
* @property {object} [gaxOptions]
|
|
690
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
691
|
+
* for more details.
|
|
692
|
+
*/
|
|
693
|
+
/**
|
|
694
|
+
* Update rows of data within this table.
|
|
695
|
+
*
|
|
696
|
+
* @see [Commit API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.Commit)
|
|
697
|
+
*
|
|
698
|
+
* @param {object|object[]} rows A map of names to values of data to insert
|
|
699
|
+
* into this table.
|
|
700
|
+
* @param {UpdateRowsOptions|CallOptions} [options] Options for configuring the request.
|
|
701
|
+
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
702
|
+
* for more details.
|
|
703
|
+
* @param {UpdateRowsCallback} [callback] Callback function.
|
|
704
|
+
* @returns {Promise<UpdateRowsResponse>}
|
|
705
|
+
*
|
|
706
|
+
* @example
|
|
707
|
+
* ```
|
|
708
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
709
|
+
* const spanner = new Spanner();
|
|
710
|
+
*
|
|
711
|
+
* const instance = spanner.instance('my-instance');
|
|
712
|
+
* const database = instance.database('my-database');
|
|
713
|
+
* const table = database.table('Singers');
|
|
714
|
+
*
|
|
715
|
+
* const row = {
|
|
716
|
+
* SingerId: 'Id3',
|
|
717
|
+
* Name: 'Joe West'
|
|
718
|
+
* };
|
|
719
|
+
*
|
|
720
|
+
* table.update(row, function(err, apiResponse) {
|
|
721
|
+
* if (err) {
|
|
722
|
+
* // Error handling omitted.
|
|
723
|
+
* }
|
|
724
|
+
*
|
|
725
|
+
* // Row updated successfully.
|
|
726
|
+
* });
|
|
727
|
+
*
|
|
728
|
+
* //-
|
|
729
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
730
|
+
* //-
|
|
731
|
+
* table.update(row)
|
|
732
|
+
* .then(function(data) {
|
|
733
|
+
* const apiResponse = data[0];
|
|
734
|
+
* });
|
|
735
|
+
*
|
|
736
|
+
* ```
|
|
737
|
+
* @example <caption>include:samples/crud.js</caption>
|
|
738
|
+
* region_tag:spanner_update_data
|
|
739
|
+
* Full example:
|
|
740
|
+
*/
|
|
741
|
+
update(rows: object | object[], options?: UpdateRowsOptions | CallOptions): Promise<UpdateRowsResponse>;
|
|
742
|
+
update(rows: object | object[], callback: UpdateRowsCallback): void;
|
|
743
|
+
update(rows: object | object[], options: UpdateRowsOptions | CallOptions, callback: UpdateRowsCallback): void;
|
|
744
|
+
/**
|
|
745
|
+
* @typedef {array} UpsertRowsResponse
|
|
746
|
+
* @property {CommitResponse} 0 The commit response.
|
|
747
|
+
*/
|
|
748
|
+
/**
|
|
749
|
+
* @callback UpsertRowsCallback
|
|
750
|
+
* @param {?Error} error Request error, if any.
|
|
751
|
+
* @param {CommitResponse} apiResponse The full API response.
|
|
752
|
+
*/
|
|
753
|
+
/**
|
|
754
|
+
* @typedef {object} UpsertRowsOptions
|
|
755
|
+
* @property {google.spanner.v1.IRequestOptions} requestOptions The request options to include
|
|
756
|
+
* with the commit request.
|
|
757
|
+
* @property {boolean} returnCommitStats Include statistics related to the
|
|
758
|
+
* transaction in the {@link CommitResponse}.
|
|
759
|
+
* @property {object} [gaxOptions]
|
|
760
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
761
|
+
* for more details.
|
|
762
|
+
*/
|
|
763
|
+
/**
|
|
764
|
+
* Insert or update rows of data within this table.
|
|
765
|
+
*
|
|
766
|
+
* @see [Commit API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.Commit)
|
|
767
|
+
*
|
|
768
|
+
* @param {object|object[]} rows A map of names to values of data to insert
|
|
769
|
+
* into this table.
|
|
770
|
+
*
|
|
771
|
+
* @param {UpsertRowsOptions|CallOptions} [options] Options for configuring the request.
|
|
772
|
+
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
773
|
+
* for more details.
|
|
774
|
+
* @param {UpsertRowsCallback} [callback] Callback function.
|
|
775
|
+
* @returns {Promise<UpsertRowsResponse>}
|
|
776
|
+
*
|
|
777
|
+
* @example
|
|
778
|
+
* ```
|
|
779
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
780
|
+
* const spanner = new Spanner();
|
|
781
|
+
*
|
|
782
|
+
* const instance = spanner.instance('my-instance');
|
|
783
|
+
* const database = instance.database('my-database');
|
|
784
|
+
* const table = database.table('Singers');
|
|
785
|
+
*
|
|
786
|
+
* const row = {
|
|
787
|
+
* SingerId: 'Id3',
|
|
788
|
+
* Name: 'Joe West'
|
|
789
|
+
* };
|
|
790
|
+
*
|
|
791
|
+
* table.upsert(row, function(err, apiResponse) {
|
|
792
|
+
* if (err) {
|
|
793
|
+
* // Error handling omitted.
|
|
794
|
+
* }
|
|
795
|
+
*
|
|
796
|
+
* // Row inserted or updated successfully.
|
|
797
|
+
* });
|
|
798
|
+
*
|
|
799
|
+
* //-
|
|
800
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
801
|
+
* //-
|
|
802
|
+
* table.upsert(row)
|
|
803
|
+
* .then(function(data) {
|
|
804
|
+
* const apiResponse = data[0];
|
|
805
|
+
* });
|
|
806
|
+
* ```
|
|
807
|
+
*/
|
|
808
|
+
upsert(rows: object | object[], options?: UpsertRowsOptions | CallOptions): Promise<UpsertRowsResponse>;
|
|
809
|
+
upsert(rows: object | object[], callback: UpsertRowsCallback): void;
|
|
810
|
+
upsert(rows: object | object[], options: UpsertRowsOptions | CallOptions, callback: UpsertRowsCallback): void;
|
|
811
|
+
/**
|
|
812
|
+
* Creates a new transaction and applies the desired mutation via
|
|
813
|
+
* {@link Transaction#commit}.
|
|
814
|
+
*
|
|
815
|
+
* @see [Commit API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.Commit)
|
|
816
|
+
*
|
|
817
|
+
* @private
|
|
818
|
+
*
|
|
819
|
+
* @param {string} method CRUD method (insert, update, etc.).
|
|
820
|
+
* @param {object|object[]} rows A map of names to values of data to insert
|
|
821
|
+
* into this table.
|
|
822
|
+
* @param {function} callback The callback function.
|
|
823
|
+
*/
|
|
824
|
+
private _mutate;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Reference to the {@link Table} class.
|
|
828
|
+
* @name module:@google-cloud/spanner.Table
|
|
829
|
+
* @see Table
|
|
830
|
+
*/
|
|
831
|
+
export { Table };
|