Idiomatic class for interacting with Cloud Datastore. Uses the lower-level DatastoreClient class under the hood.
In addition to the constructor options shown here, the Datastore class constructor accepts the same options accepted by DatastoreClient.
The Datastore EmulatorMake sure you have the gcloud SDK installed, then run:
$ gcloud beta emulators datastore start --no-legacy
You will see the following printed:
\[datastore\] API endpoint: http://localhost:8005 \[datastore\] If you are using a library that supports the DATASTORE\_EMULATOR\_HOST environment variable, run: \[datastore\] \[datastore\] export DATASTORE\_EMULATOR\_HOST=localhost:8005 \[datastore\] \[datastore\] Dev App Server is now running.
Set that environment variable and your localhost Datastore will automatically be used. You can also pass this address in manually with apiEndpoint
.
Additionally, DATASTORE_PROJECT_ID
is recognized. If you have this set, you don't need to provide a projectId
.
See Cloud Datastore Concepts Overview
InheritanceDatastoreRequest > Datastore Package@google-cloud/datastore Constructors (constructor)(options)constructor(options?: DatastoreOptions);
Constructs a new instance of the Datastore
class
clients_: Map<string, ClientStub>;
Property Value Type Description Map<string, ClientStub> customEndpoint_
customEndpoint_?: boolean;
Property Value DatastoreRequest
DatastoreRequest: typeof DatastoreRequest;
DatastoreRequest class.
Datastore.DatastoreRequest DatastoreRequest {constructor}
Property Value Type Description typeof DatastoreRequest defaultBaseUrl_ Property Value KEYKEY: typeof entity.KEY_SYMBOL;
Property Value Type Description typeof entity.KEY_SYMBOL KEY
static KEY: typeof entity.KEY_SYMBOL;
Access the Key from an Entity object.
Datastore#KEY {symbol}
Property Value Type Description typeof entity.KEY_SYMBOL MORE_RESULTS_AFTER_CURSORMORE_RESULTS_AFTER_CURSOR: string;
Property Value MORE_RESULTS_AFTER_CURSOR
static MORE_RESULTS_AFTER_CURSOR: string;
This is one of three values which may be returned from , , and as info.moreResults
.
There *may* be more results after the specified end cursor.
{string}
Property Value MORE_RESULTS_AFTER_LIMITMORE_RESULTS_AFTER_LIMIT: string;
Property Value MORE_RESULTS_AFTER_LIMIT
static MORE_RESULTS_AFTER_LIMIT: string;
This is one of three values which may be returned from , , and as info.moreResults
.
There *may* be more results after the specified limit.
{string}
Property Value namespace Property Value NO_MORE_RESULTS Property Value NO_MORE_RESULTSstatic NO_MORE_RESULTS: string;
This is one of three values which may be returned from , , and as info.moreResults
.
There are no more results left to query for.
{string}
Property Value optionsoptions: DatastoreOptions;
Property Value port_ Property Value Query
Query class.
Datastore.Query Query {constructor}
Property Value Type Description typeof Query TransactionTransaction: typeof Transaction;
Transaction class.
Datastore.Transaction Transaction {constructor}
Property Value Type Description typeof Transaction Methods createQuery(kind)createQuery(kind?: string): Query;
Parameter Name Description kind string
createQuery(kind?: string[]): Query;
Parameter Name Description kind string[]
createQuery(namespace: string, kind: string): Query;
Parameters Name Description namespace string
string
createQuery(namespace: string, kind: string[]): Query;
Parameters Name Description namespace string
string[]
determineBaseUrl_(customApiEndpoint?: string): void;
Determine the appropriate endpoint to use for API requests. If not explicitly defined, check for the "DATASTORE_EMULATOR_HOST" environment variable, used to connect to a local Datastore server.
Parameter Name Description customApiEndpointstring
Custom API endpoint.
Returns double(value)double(value: number): entity.Double;
Parameter Name Description value number
static double(value: number): entity.Double;
Helper function to get a Datastore Double object.
Parameter Name Description valuenumber
The double value.
Returns Type Description entity.Double{object}
export(config)export(config: ExportEntitiesConfig): Promise<LongRunningResponse>;
Parameter Returns export(config, callback)
export(config: ExportEntitiesConfig, callback: LongRunningCallback): void;
Parameters Returns geoPoint(coordinates)
geoPoint(coordinates: entity.Coordinates): entity.GeoPoint;
Parameter Name Description coordinates entity.Coordinates
static geoPoint(coordinates: entity.Coordinates): entity.GeoPoint;
Helper function to get a Datastore Geo Point object.
Parameter Name Description coordinatesentity.Coordinates
Coordinate value.
Returns Type Description entity.GeoPoint{object}
getIndexes(options)getIndexes(options?: GetIndexesOptions): Promise<GetIndexesResponse>;
Parameter Name Description options GetIndexesOptions
getIndexes(options: GetIndexesOptions, callback: GetIndexesCallback): void;
Parameters Name Description options GetIndexesOptions
GetIndexesCallback
getIndexes(callback: GetIndexesCallback): void;
Parameter Name Description callback GetIndexesCallback
getIndexesStream(options?: GetIndexesOptions): NodeJS.ReadableStream;
Get all of the indexes in this project as a readable object stream.
Parameter Name Description optionsGetIndexesOptions
Configuration object. See for a complete list of options.
Returns Type Description NodeJS.ReadableStream{ReadableStream
getProjectId()getProjectId(): Promise<string>;
Returns Type Description Promise<string> import(config)
import(config: ImportEntitiesConfig): Promise<LongRunningResponse>;
Parameter Returns import(config, callback)
import(config: ImportEntitiesConfig, callback: LongRunningCallback): void;
Parameters Returns index(id)
index(id: string): Index;
Get a reference to an Index.
Parameter Name Description idstring
The index name or id.
Returns Type Description Index{Index}
insert(entities)insert(entities: Entities): Promise<InsertResponse>;
Parameter Name Description entities Entities
insert(entities: Entities, callback: InsertCallback): void;
Parameters Returns int(value)
int(value: number | string): entity.Int;
Parameter Name Description value number | string
static int(value: number | string): entity.Int;
Helper function to get a Datastore Integer object.
This is also useful when using an ID outside the bounds of a JavaScript Number object.
Parameter Name Description valuenumber | string
The integer value.
Returns Type Description entity.Int{object}
isDouble(value)isDouble(value?: {}): boolean;
Parameter Name Description value {}
static isDouble(value?: {}): boolean;
Helper function to check if something is a Datastore Double object.
Parameter Name Description value{}
{boolean}
isGeoPoint(value)isGeoPoint(value?: {}): boolean;
Parameter Name Description value {}
static isGeoPoint(value?: {}): boolean;
Helper function to check if something is a Datastore Geo Point object.
Parameter Name Description value{}
{boolean}
isInt(value)isInt(value?: {}): boolean;
Parameter Name Description value {}
static isInt(value?: {}): boolean;
Helper function to check if something is a Datastore Integer object.
Parameter Name Description value{}
{boolean}
isKey(value)isKey(value?: {}): boolean;
Parameter Name Description value {}
static isKey(value?: {}): boolean;
Helper function to check if something is a Datastore Key object.
Parameter Name Description value{}
{boolean}
key(options)key(options: entity.KeyOptions): entity.Key;
Parameter Name Description options KeyOptions
key(path: PathType[]): entity.Key;
Parameter Returns Type Description entity.Key key(path)
key(path: string): entity.Key;
Parameter Name Description path string
keyFromLegacyUrlsafe(key: string): entity.Key;
Helper to convert URL safe key string to entity key object
This is intended to work with the "legacy" representation of a datastore "Key" used within Google App Engine (a so-called "Reference").
Parameter Name Description keystring
Entity key object.
Returns Type Description entity.Key{string} Created urlsafe key.
keyToLegacyUrlSafe(key, locationPrefix)keyToLegacyUrlSafe(key: entity.Key, locationPrefix?: string): Promise<string>;
Parameters Name Description key entity.Key
string
keyToLegacyUrlSafe(key: entity.Key, callback: KeyToLegacyUrlSafeCallback): void;
Parameters Returns keyToLegacyUrlSafe(key, locationPrefix, callback)
keyToLegacyUrlSafe(key: entity.Key, locationPrefix: string, callback: KeyToLegacyUrlSafeCallback): void;
Parameters Returns save(entities, gaxOptions)
save(entities: Entities, gaxOptions?: CallOptions): Promise<SaveResponse>;
Parameters Name Description entities Entities
CallOptions
save(entities: Entities, gaxOptions: CallOptions, callback: SaveCallback): void;
Parameters Name Description entities Entities
CallOptions
SaveCallback
save(entities: Entities, callback: SaveCallback): void;
Parameters Name Description entities Entities
SaveCallback
transaction(options?: TransactionOptions): Transaction;
Create a new Transaction object.
Parameter Returns Type Description Transaction{Transaction}
update(entities)update(entities: Entities): Promise<UpdateResponse>;
Parameter Name Description entities Entities
update(entities: Entities, callback: UpdateCallback): void;
Parameters Returns upsert(entities)
upsert(entities: Entities): Promise<UpsertResponse>;
Parameter Name Description entities Entities
upsert(entities: Entities, callback: UpsertCallback): void;
Parameters Returns
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4