Constructor
new SpannerClient(optionsopt, gaxInstanceopt)
Construct an instance of SpannerClient.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. The options accepted by the constructor are described in detail in this document. The common options are: Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||
gaxInstance |
gax |
<optional> |
loaded instance of |
Members
apiEndpoint
The DNS address for this API service.
apiEndpoint
The DNS address for this API service - same as servicePath.
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
The DNS address for this API service.
Methods
batchWrite(request, optionsopt) → {Stream}
Batches the supplied mutation groups in a collection of efficient transactions. All mutations in a group are committed atomically. However, mutations across groups can be committed non-atomically in an unspecified order and thus, they must be independent of each other. Partial failure is possible, i.e., some groups may have been committed successfully, while some may have failed. The results of individual batches are streamed into the response as the batches are applied.
BatchWrite requests are not replay protected, meaning that each mutation group may be applied more than once. Replays of non-idempotent mutations may have undesirable effects. For example, replays of an insert mutation may produce an already exists error or if you use generated or commit timestamp-based keys, it may result in additional rows being added to the mutation's table. We recommend structuring your mutation groups to be idempotent to avoid this issue.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits BatchWriteResponse on 'data' event. Please see the documentation for more details and examples. |
close() → {Promise}
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves when the client is closed. |
databasePath(project, instance, database) → {string}
Return a fully-qualified database resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
instance |
string | |
database |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
executeStreamingSql(request, optionsopt) → {Stream}
Like ExecuteSql, except returns the result set as a stream. Unlike ExecuteSql, there is no limit on the size of the returned result set. However, no individual row in the result set can exceed 100 MiB, and no column value can exceed 10 MiB.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits PartialResultSet on 'data' event. Please see the documentation for more details and examples. |
getProjectId() → {Promise}
Return the project ID used by this class.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves to string containing the project ID. |
initialize() → {Promise}
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves to an authenticated service stub. |
listSessionsAsync(request, optionsopt) → {Object}
Equivalent to listSessions
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Session. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
listSessionsStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing Session on 'data' event.
The client library will perform auto-pagination by default: it will call the API as many
times as needed. Note that it can affect your quota.
We recommend using |
matchDatabaseFromDatabaseName(databaseName) → {string}
Parse the database from Database resource.
Parameters:
Name | Type | Description |
---|---|---|
databaseName |
string |
A fully-qualified path representing Database resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the database. |
matchDatabaseFromSessionName(sessionName) → {string}
Parse the database from Session resource.
Parameters:
Name | Type | Description |
---|---|---|
sessionName |
string |
A fully-qualified path representing Session resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the database. |
matchInstanceFromDatabaseName(databaseName) → {string}
Parse the instance from Database resource.
Parameters:
Name | Type | Description |
---|---|---|
databaseName |
string |
A fully-qualified path representing Database resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the instance. |
matchInstanceFromSessionName(sessionName) → {string}
Parse the instance from Session resource.
Parameters:
Name | Type | Description |
---|---|---|
sessionName |
string |
A fully-qualified path representing Session resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the instance. |
matchProjectFromDatabaseName(databaseName) → {string}
Parse the project from Database resource.
Parameters:
Name | Type | Description |
---|---|---|
databaseName |
string |
A fully-qualified path representing Database resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromSessionName(sessionName) → {string}
Parse the project from Session resource.
Parameters:
Name | Type | Description |
---|---|---|
sessionName |
string |
A fully-qualified path representing Session resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchSessionFromSessionName(sessionName) → {string}
Parse the session from Session resource.
Parameters:
Name | Type | Description |
---|---|---|
sessionName |
string |
A fully-qualified path representing Session resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the session. |
sessionPath(project, instance, database, session) → {string}
Return a fully-qualified session resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
instance |
string | |
database |
string | |
session |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
streamingRead(request, optionsopt) → {Stream}
Like Read, except returns the result set as a stream. Unlike Read, there is no limit on the size of the returned result set. However, no individual row in the result set can exceed 100 MiB, and no column value can exceed 10 MiB.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits PartialResultSet on 'data' event. Please see the documentation for more details and examples. |