Handle logic for Datastore API operations. Handles request logic for Datastore.
Creates requests to the Datastore endpoint. Designed to be inherited by the Datastore and Transaction classes.
Package
@google-cloud/datastore!Properties
datastore
datastore
:
Datastore
;
Type | Description |
---|---|
Datastore |
id
id
:
string
|
undefined
;
Type | Description |
---|---|
string | undefined |
requestCallbacks_
requestCallbacks_
:
Array
< (
err
:
Error
|
null
,
resp
:
Entity
|
null
)
=
>
void
>
|
Entity
;
Type | Description |
---|---|
Array <(err: Error | null, resp: Entity | null) => void> | Entity |
requests_
requests_
:
Entity
|
{
mutations
:
Array
< {}>;
};
Type | Description |
---|---|
Entity | { mutations: Array <{}>; } |
Methods
allocateIds(key, options)
allocateIds
(
key
:
entity
.
Key
,
options
:
AllocateIdsOptions
|
number
)
:
Promise<AllocateIdsResponse>
;
Type | Name | Description |
---|---|---|
entity.Key
|
key | |
AllocateIdsOptions
| number
|
options |
Type | Description |
---|---|
Promise < AllocateIdsResponse > |
allocateIds(key, options, callback)
allocateIds
(
key
:
entity
.
Key
,
options
:
AllocateIdsOptions
|
number
,
callback
:
AllocateIdsCallback
)
:
void
;
Type | Name | Description |
---|---|---|
entity.Key
|
key | |
AllocateIdsOptions
| number
|
options | |
AllocateIdsCallback
|
callback |
Type | Description |
---|---|
void |
createReadStream(keys, options)
createReadStream
(
keys
:
Entities
,
options
?:
CreateReadStreamOptions
)
:
Transform
;
Retrieve the entities as a readable object stream.
Type | Name | Description |
---|---|---|
Entities
|
keys | Datastore key object(s). |
CreateReadStreamOptions
|
options | Optional configuration. See for a complete list of options. |
Type | Description |
---|---|
Transform |
delete(keys, gaxOptions)
delete
(
keys
:
Entities
,
gaxOptions
?:
CallOptions
)
:
Promise<DeleteResponse>
;
Type | Name | Description |
---|---|---|
Entities
|
keys | |
CallOptions
|
gaxOptions |
Type | Description |
---|---|
Promise < DeleteResponse > |
delete(keys, callback)
delete
(
keys
:
Entities
,
callback
:
DeleteCallback
)
:
void
;
Type | Name | Description |
---|---|---|
Entities
|
keys | |
DeleteCallback
|
callback |
Type | Description |
---|---|
void |
delete(keys, gaxOptions, callback)
delete
(
keys
:
Entities
,
gaxOptions
:
CallOptions
,
callback
:
DeleteCallback
)
:
void
;
Type | Name | Description |
---|---|---|
Entities
|
keys | |
CallOptions
|
gaxOptions | |
DeleteCallback
|
callback |
Type | Description |
---|---|
void |
get(keys, options)
get
(
keys
:
entity
.
Key
|
entity
.
Key
[],
options
?:
CreateReadStreamOptions
)
:
Promise<GetResponse>
;
Type | Name | Description |
---|---|---|
entity.Key
| entity.Key
[]
|
keys | |
CreateReadStreamOptions
|
options |
Type | Description |
---|---|
Promise < GetResponse > |
get(keys, callback)
get
(
keys
:
entity
.
Key
|
entity
.
Key
[],
callback
:
GetCallback
)
:
void
;
Type | Name | Description |
---|---|---|
entity.Key
| entity.Key
[]
|
keys | |
GetCallback
|
callback |
Type | Description |
---|---|
void |
get(keys, options, callback)
get
(
keys
:
entity
.
Key
|
entity
.
Key
[],
options
:
CreateReadStreamOptions
,
callback
:
GetCallback
)
:
void
;
Type | Name | Description |
---|---|---|
entity.Key
| entity.Key
[]
|
keys | |
CreateReadStreamOptions
|
options | |
GetCallback
|
callback |
Type | Description |
---|---|
void |
merge(entities)
merge
(
entities
:
Entities
)
:
Promise<CommitResponse>
;
Type | Name | Description |
---|---|---|
Entities
|
entities |
Type | Description |
---|---|
Promise < CommitResponse > |
merge(entities, callback)
merge
(
entities
:
Entities
,
callback
:
SaveCallback
)
:
void
;
Type | Name | Description |
---|---|---|
Entities
|
entities | |
SaveCallback
|
callback |
Type | Description |
---|---|
void |
prepareEntityObject_(obj)
static
prepareEntityObject_
(
obj
:
Entity
)
:
PrepareEntityObjectResponse
;
Format a user's input to mutation methods. This will create a deep clone of the input, as well as allow users to pass an object in the format of an entity.
Both of the following formats can be supplied supported:
datastore.save({ key: datastore.key('Kind'), data: { foo: 'bar' } }, (err) => {})
const entity = { foo: 'bar' } entity[datastore.KEY] = datastore.key('Kind') datastore.save(entity, (err) => {})
[#1803] https://github.com/GoogleCloudPlatform/google-cloud-node/issues/1803
Type | Name | Description |
---|---|---|
Entity
|
obj | The user's input object. |
Type | Description |
---|---|
PrepareEntityObjectResponse |
prepareGaxRequest_(config, callback)
prepareGaxRequest_
(
config
:
RequestConfig
,
callback
:
Function
)
:
void
;
Type | Name | Description |
---|---|---|
RequestConfig
|
config | |
Function
|
callback |
Type | Description |
---|---|
void |
request_(config, callback)
request_
(
config
:
RequestConfig
,
callback
:
RequestCallback
)
:
void
;
Type | Name | Description |
---|---|---|
RequestConfig
|
config | |
RequestCallback
|
callback |
Type | Description |
---|---|
void |
requestStream_(config)
requestStream_
(
config
:
RequestConfig
)
:
AbortableDuplex
;
Make a request as a stream.
Type | Name | Description |
---|---|---|
RequestConfig
|
config | Configuration object. |
Type | Description |
---|---|
AbortableDuplex |
runQuery(query, options)
runQuery
(
query
:
Query
,
options
?:
RunQueryOptions
)
:
Promise<RunQueryResponse>
;
Type | Name | Description |
---|---|---|
Query
|
query | |
RunQueryOptions
|
options |
Type | Description |
---|---|
Promise < RunQueryResponse > |
runQuery(query, options, callback)
runQuery
(
query
:
Query
,
options
:
RunQueryOptions
,
callback
:
RunQueryCallback
)
:
void
;
Type | Name | Description |
---|---|---|
Query
|
query | |
RunQueryOptions
|
options | |
RunQueryCallback
|
callback |
Type | Description |
---|---|
void |
runQuery(query, callback)
runQuery
(
query
:
Query
,
callback
:
RunQueryCallback
)
:
void
;
Type | Name | Description |
---|---|---|
Query
|
query | |
RunQueryCallback
|
callback |
Type | Description |
---|---|
void |
runQueryStream(query, options)
runQueryStream
(
query
:
Query
,
options
?:
RunQueryStreamOptions
)
:
Transform
;
Get a list of entities as a readable object stream.
See for a list of all available options.
Type | Name | Description |
---|---|---|
Query
|
query | Query object. |
RunQueryStreamOptions
|
options | Optional configuration. |
Type | Description |
---|---|
Transform |