import { Datastore } from "https://deno.land/x/google_datastore@0.0.14/mod.ts";
An interface to Google Datastore. This is the main class users should use to connect to a Google Datastore instance.
Example
import { Datastore } from "https://deno.land/x/google_datastore/mod.ts";
import keys from "./service-account.json" assert { type: "json" };
const datastore = new Datastore(keys);
const result = await datastore.query({ kind: "book" });
Constructors
new
Datastore(datastoreInit: DatastoreInit)Properties
readonly
operations: DatastoreOperationsAPIs related to managing operations (long running processes).
Methods
allocateIds(...keys: Key[]): Promise<Key[]>
Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted.
commit(mutations: Mutation[], options?: CommitOptions): AsyncIterableIterator<CommitResponse>
Commits a transaction, optionally creating, deleting or modifying some entities.
An async iterable that yields up each commit response for each batch of mutations being sent.
createQuery(namespace: string, kind: string | string[]): Query
lookup(keys: Key | Key[], readOptions?: ReadOptions): Promise<LookupResponse>
Looks up entities by key.
reserveIds(keys: Key[], databaseId?: string): Promise<void>
Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore.
streamQuery(query: Query | QueryRequestGenerator): ReadableStream<Entity>
Perform a query and return the entities as a stream.