Skip to main content
Module

x/google_datastore/mod.ts>toEntity

A set of APIs that allow interfacing to Google Datastore on GCP from Deno.
Latest
variable toEntity
import { toEntity } from "https://deno.land/x/google_datastore@0.2.1/mod.ts";

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.

Example

import { toEntity } from "google_datastore.ts";

class A {
  a = "value";
  id = "a";

  [toEntity]() {
    return {
      key: { path: [ { id: this.id, kind: A.KIND } ] },
      properties: { a: { stringValue: this.a }},
    }
  }

  static KIND = "A";
}