x/google_datastore@0.0.14

A set of APIs that allow interfacing to Google Datastore on GCP from Deno.
Latest
import * as googleDatastore from "https://deno.land/x/google_datastore@0.0.14/mod.ts";

APIs for using Google Datastore from Deno.

Google Datastore is Firestore in Datastore under the hood these days, but has a more concise API and lacks the complex rule system that Firestore running in its native mode provides.

Users should create an instance of Datastore to connect to an instance of Google Datastore. Converting a datastore Entity to a JavaScript object can be done with entityToObject and a JavaScript object can be converted to an Entity via objectToEntity.

You can associate a datastore Key with a JavaScript object via the objectSetKey function. Any entities that were converted to objects with entityToObject will already have their key set, so can be mutated and then converted back to an entity and not lose their key.

Classes

Datastore

An interface to Google Datastore. This is the main class users should use to connect to a Google Datastore instance.

DatastoreError

Errors using Datastore will by of this type, which includes extra info about the error.

DatastoreIndexes

Provides the APIs for indexes for Datastore instances. Exported for documentation purposes and should not be instantiated by users.

DatastoreOperations

Provides the operations APIs on the Datastore instances. Exported for documentation purposes and should not be instantiated by users.

Variables

toEntity

A symbol which can be used to provide a custom method to generate an Entity serialization for an object. When performing objectToEntity, this method will be used instead of built in serialization of objects to entities.

Functions

datastoreValueToValue

Convert a Datastore Value to a JavaScript value.

entityToObject

Convert a Datastore Entity to a JavaScript object, which can then be serialized easily back into an Entity.

objectGetKey

Get the datastore Key for an object, or return undefined.

objectSetKey

Assign a datastore Key to a JavaScript object. This key will then be set in any resulting Entity.

objectToEntity

A function which converts most JavaScript objects to entities that can be stored in Google Datastore. If the object as a toEntity symbol method, it will be used to serialize the entity.

Interfaces

CommitOptions

Options that can be used when committing mutations to the datastore.

DatastoreInit

The information from a service account JSON file that is used by the Datastore to be able to securely connect.

google-datastore

A set of APIs that allow interfacing to Google Datastore on GCP from Deno.

Usage

The main interface is via a Datastore instance. To create an instance, provide service account keys JSON which contains the information required to securely connect to your Google Datastore instance:

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);

Copyright 2022 Kitson P. Kelly. All rights reserved. MIT License.