Each RPC normalizes the partition IDs of the keys in its input entities, and always returns entities with keys with normalized partition IDs. This applies to all keys and entities, including those in values, except keys with both an empty path and an empty or unset partition ID. Normalization of input keys sets the project ID (if not already set) to the project ID from the request.
v1
Package
@google-cloud/datastoreConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of DatastoreClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
auth
auth: gax.GoogleAuth;
datastoreStub
datastoreStub?: Promise<{
[name: string]: Function;
}>;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
operationsClient
operationsClient: gax.OperationsClient;
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
allocateIds(request, options)
allocateIds(request?: protos.google.datastore.v1.IAllocateIdsRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IAllocateIdsResponse,
protos.google.datastore.v1.IAllocateIdsRequest | undefined,
{} | undefined
]>;
Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted.
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IAllocateIdsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
google.datastore.v1.IAllocateIdsResponse,
google.datastore.v1.IAllocateIdsRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Required. A list of keys with incomplete key paths for which to allocate
* IDs. No key may be reserved/read-only.
*/
// const keys = [1,2,3,4]
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callAllocateIds() {
// Construct request
const request = {
projectId,
keys,
};
// Run request
const response = await datastoreClient.allocateIds(request);
console.log(response);
}
callAllocateIds();
allocateIds(request, options, callback)
allocateIds(request: protos.google.datastore.v1.IAllocateIdsRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IAllocateIdsRequest
|
options |
CallOptions
|
callback |
Callback<google.datastore.v1.IAllocateIdsResponse, google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
allocateIds(request, callback)
allocateIds(request: protos.google.datastore.v1.IAllocateIdsRequest, callback: Callback<protos.google.datastore.v1.IAllocateIdsResponse, protos.google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IAllocateIdsRequest
|
callback |
Callback<google.datastore.v1.IAllocateIdsResponse, google.datastore.v1.IAllocateIdsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
beginTransaction(request, options)
beginTransaction(request?: protos.google.datastore.v1.IBeginTransactionRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IBeginTransactionResponse,
protos.google.datastore.v1.IBeginTransactionRequest | undefined,
{} | undefined
]>;
Begins a new transaction.
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IBeginTransactionRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
google.datastore.v1.IBeginTransactionResponse,
google.datastore.v1.IBeginTransactionRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Options for a new transaction.
*/
// const transactionOptions = {}
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callBeginTransaction() {
// Construct request
const request = {
projectId,
};
// Run request
const response = await datastoreClient.beginTransaction(request);
console.log(response);
}
callBeginTransaction();
beginTransaction(request, options, callback)
beginTransaction(request: protos.google.datastore.v1.IBeginTransactionRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IBeginTransactionRequest
|
options |
CallOptions
|
callback |
Callback<google.datastore.v1.IBeginTransactionResponse, google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
beginTransaction(request, callback)
beginTransaction(request: protos.google.datastore.v1.IBeginTransactionRequest, callback: Callback<protos.google.datastore.v1.IBeginTransactionResponse, protos.google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IBeginTransactionRequest
|
callback |
Callback<google.datastore.v1.IBeginTransactionResponse, google.datastore.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
cancelOperation(request, options, callback)
cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED
.
Parameters | |
---|---|
Name | Description |
request |
protos.google.longrunning.CancelOperationRequest
The request object that will be sent. |
options |
CallOptions | Callback<google.protobuf.Empty, google.longrunning.CancelOperationRequest, {} | undefined | null>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<google.longrunning.CancelOperationRequest, google.protobuf.Empty, {} | undefined | null>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<google.protobuf.Empty> |
const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});
close()
close(): Promise<void>;
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<void> | {Promise} A promise that resolves when the client is closed. |
commit(request, options)
commit(request?: protos.google.datastore.v1.ICommitRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.ICommitResponse,
protos.google.datastore.v1.ICommitRequest | undefined,
{} | undefined
]>;
Commits a transaction, optionally creating, deleting or modifying some entities.
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.ICommitRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
google.datastore.v1.ICommitResponse,
google.datastore.v1.ICommitRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* The type of commit to perform. Defaults to `TRANSACTIONAL`.
*/
// const mode = {}
/**
* The identifier of the transaction associated with the commit. A
* transaction identifier is returned by a call to
* Datastore.BeginTransaction google.datastore.v1.Datastore.BeginTransaction.
*/
// const transaction = Buffer.from('string')
/**
* Options for beginning a new transaction for this request.
* The transaction is committed when the request completes. If specified,
* TransactionOptions.mode google.datastore.v1.TransactionOptions must be
* TransactionOptions.ReadWrite google.datastore.v1.TransactionOptions.ReadWrite.
*/
// const singleUseTransaction = {}
/**
* The mutations to perform.
* When mode is `TRANSACTIONAL`, mutations affecting a single entity are
* applied in order. The following sequences of mutations affecting a single
* entity are not permitted in a single `Commit` request:
* - `insert` followed by `insert`
* - `update` followed by `insert`
* - `upsert` followed by `insert`
* - `delete` followed by `update`
* When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
* entity.
*/
// const mutations = [1,2,3,4]
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callCommit() {
// Construct request
const request = {
projectId,
};
// Run request
const response = await datastoreClient.commit(request);
console.log(response);
}
callCommit();
commit(request, options, callback)
commit(request: protos.google.datastore.v1.ICommitRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.ICommitRequest
|
options |
CallOptions
|
callback |
Callback<google.datastore.v1.ICommitResponse, google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
commit(request, callback)
commit(request: protos.google.datastore.v1.ICommitRequest, callback: Callback<protos.google.datastore.v1.ICommitResponse, protos.google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.ICommitRequest
|
callback |
Callback<google.datastore.v1.ICommitResponse, google.datastore.v1.ICommitRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteOperation(request, options, callback)
deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;
Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
protos.google.longrunning.DeleteOperationRequest
The request object that will be sent. |
options |
CallOptions | Callback<google.protobuf.Empty, google.longrunning.DeleteOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<google.protobuf.Empty, google.longrunning.DeleteOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<google.protobuf.Empty> |
const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});
getOperation(request, options, callback)
getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters | |
---|---|
Name | Description |
request |
protos.google.longrunning.GetOperationRequest
The request object that will be sent. |
options |
CallOptions | Callback<google.longrunning.Operation, google.longrunning.GetOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<google.longrunning.Operation, google.longrunning.GetOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call. The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<[google.longrunning.Operation]> |
const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)
getProjectId()
getProjectId(): Promise<string>;
Returns | |
---|---|
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter | |
---|---|
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns | |
---|---|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
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<{
[name: string]: Function;
}> | {Promise} A promise that resolves to an authenticated service stub. |
listOperationsAsync(request, options)
listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED
. Returns an iterable object.
For-await-of syntax is used with the iterable to recursively get response element on-demand.
Parameters | |
---|---|
Name | Description |
request |
protos.google.longrunning.ListOperationsRequest
The request object that will be sent. |
options |
CallOptions
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<google.longrunning.ListOperationsResponse> | {Object} An iterable Object that conforms to iteration protocols. |
const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)
lookup(request, options)
lookup(request?: protos.google.datastore.v1.ILookupRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.ILookupResponse,
protos.google.datastore.v1.ILookupRequest | undefined,
{} | undefined
]>;
Looks up entities by key.
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.ILookupRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
google.datastore.v1.ILookupResponse,
google.datastore.v1.ILookupRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* The options for this lookup request.
*/
// const readOptions = {}
/**
* Required. Keys of entities to look up.
*/
// const keys = [1,2,3,4]
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callLookup() {
// Construct request
const request = {
projectId,
keys,
};
// Run request
const response = await datastoreClient.lookup(request);
console.log(response);
}
callLookup();
lookup(request, options, callback)
lookup(request: protos.google.datastore.v1.ILookupRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.ILookupRequest
|
options |
CallOptions
|
callback |
Callback<google.datastore.v1.ILookupResponse, google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
lookup(request, callback)
lookup(request: protos.google.datastore.v1.ILookupRequest, callback: Callback<protos.google.datastore.v1.ILookupResponse, protos.google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.ILookupRequest
|
callback |
Callback<google.datastore.v1.ILookupResponse, google.datastore.v1.ILookupRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
reserveIds(request, options)
reserveIds(request?: protos.google.datastore.v1.IReserveIdsRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IReserveIdsResponse,
protos.google.datastore.v1.IReserveIdsRequest | undefined,
{} | undefined
]>;
Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore.
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IReserveIdsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
google.datastore.v1.IReserveIdsResponse,
google.datastore.v1.IReserveIdsRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Required. A list of keys with complete key paths whose numeric IDs should
* not be auto-allocated.
*/
// const keys = [1,2,3,4]
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callReserveIds() {
// Construct request
const request = {
projectId,
keys,
};
// Run request
const response = await datastoreClient.reserveIds(request);
console.log(response);
}
callReserveIds();
reserveIds(request, options, callback)
reserveIds(request: protos.google.datastore.v1.IReserveIdsRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IReserveIdsRequest
|
options |
CallOptions
|
callback |
Callback<google.datastore.v1.IReserveIdsResponse, google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
reserveIds(request, callback)
reserveIds(request: protos.google.datastore.v1.IReserveIdsRequest, callback: Callback<protos.google.datastore.v1.IReserveIdsResponse, protos.google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IReserveIdsRequest
|
callback |
Callback<google.datastore.v1.IReserveIdsResponse, google.datastore.v1.IReserveIdsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
rollback(request, options)
rollback(request?: protos.google.datastore.v1.IRollbackRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IRollbackResponse,
protos.google.datastore.v1.IRollbackRequest | undefined,
{} | undefined
]>;
Rolls back a transaction.
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IRollbackRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
google.datastore.v1.IRollbackResponse,
google.datastore.v1.IRollbackRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Required. The transaction identifier, returned by a call to
* Datastore.BeginTransaction google.datastore.v1.Datastore.BeginTransaction.
*/
// const transaction = Buffer.from('string')
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callRollback() {
// Construct request
const request = {
projectId,
transaction,
};
// Run request
const response = await datastoreClient.rollback(request);
console.log(response);
}
callRollback();
rollback(request, options, callback)
rollback(request: protos.google.datastore.v1.IRollbackRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IRollbackRequest
|
options |
CallOptions
|
callback |
Callback<google.datastore.v1.IRollbackResponse, google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
rollback(request, callback)
rollback(request: protos.google.datastore.v1.IRollbackRequest, callback: Callback<protos.google.datastore.v1.IRollbackResponse, protos.google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IRollbackRequest
|
callback |
Callback<google.datastore.v1.IRollbackResponse, google.datastore.v1.IRollbackRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runAggregationQuery(request, options)
runAggregationQuery(request?: protos.google.datastore.v1.IRunAggregationQueryRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IRunAggregationQueryResponse,
protos.google.datastore.v1.IRunAggregationQueryRequest | undefined,
{} | undefined
]>;
Runs an aggregation query.
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IRunAggregationQueryRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
google.datastore.v1.IRunAggregationQueryResponse,
google.datastore.v1.IRunAggregationQueryRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Entities are partitioned into subsets, identified by a partition ID.
* Queries are scoped to a single partition.
* This partition ID is normalized with the standard default context
* partition ID.
*/
// const partitionId = {}
/**
* The options for this query.
*/
// const readOptions = {}
/**
* The query to run.
*/
// const aggregationQuery = {}
/**
* The GQL query to run. This query must be an aggregation query.
*/
// const gqlQuery = {}
/**
* Optional. The mode in which the query request is processed. This field is
* optional, and when not provided, it defaults to `NORMAL` mode where no
* additional statistics will be returned with the query results.
*/
// const mode = {}
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callRunAggregationQuery() {
// Construct request
const request = {
projectId,
};
// Run request
const response = await datastoreClient.runAggregationQuery(request);
console.log(response);
}
callRunAggregationQuery();
runAggregationQuery(request, options, callback)
runAggregationQuery(request: protos.google.datastore.v1.IRunAggregationQueryRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IRunAggregationQueryResponse, protos.google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IRunAggregationQueryRequest
|
options |
CallOptions
|
callback |
Callback<google.datastore.v1.IRunAggregationQueryResponse, google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runAggregationQuery(request, callback)
runAggregationQuery(request: protos.google.datastore.v1.IRunAggregationQueryRequest, callback: Callback<protos.google.datastore.v1.IRunAggregationQueryResponse, protos.google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IRunAggregationQueryRequest
|
callback |
Callback<google.datastore.v1.IRunAggregationQueryResponse, google.datastore.v1.IRunAggregationQueryRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runQuery(request, options)
runQuery(request?: protos.google.datastore.v1.IRunQueryRequest, options?: CallOptions): Promise<[
protos.google.datastore.v1.IRunQueryResponse,
protos.google.datastore.v1.IRunQueryRequest | undefined,
{} | undefined
]>;
Queries for entities.
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IRunQueryRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
google.datastore.v1.IRunQueryResponse,
google.datastore.v1.IRunQueryRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the project against which to make the request.
*/
// const projectId = 'abc123'
/**
* The ID of the database against which to make the request.
* '(default)' is not allowed; please use empty string '' to refer the default
* database.
*/
// const databaseId = 'abc123'
/**
* Entities are partitioned into subsets, identified by a partition ID.
* Queries are scoped to a single partition.
* This partition ID is normalized with the standard default context
* partition ID.
*/
// const partitionId = {}
/**
* The options for this query.
*/
// const readOptions = {}
/**
* The query to run.
*/
// const query = {}
/**
* The GQL query to run. This query must be a non-aggregation query.
*/
// const gqlQuery = {}
/**
* Optional. The mode in which the query request is processed. This field is
* optional, and when not provided, it defaults to `NORMAL` mode where no
* additional statistics will be returned with the query results.
*/
// const mode = {}
// Imports the Datastore library
const {DatastoreClient} = require('@google-cloud/datastore').v1;
// Instantiates a client
const datastoreClient = new DatastoreClient();
async function callRunQuery() {
// Construct request
const request = {
projectId,
};
// Run request
const response = await datastoreClient.runQuery(request);
console.log(response);
}
callRunQuery();
runQuery(request, options, callback)
runQuery(request: protos.google.datastore.v1.IRunQueryRequest, options: CallOptions, callback: Callback<protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IRunQueryRequest
|
options |
CallOptions
|
callback |
Callback<google.datastore.v1.IRunQueryResponse, google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
runQuery(request, callback)
runQuery(request: protos.google.datastore.v1.IRunQueryRequest, callback: Callback<protos.google.datastore.v1.IRunQueryResponse, protos.google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
protos.google.datastore.v1.IRunQueryRequest
|
callback |
Callback<google.datastore.v1.IRunQueryResponse, google.datastore.v1.IRunQueryRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |