Saturday 27 June 2020

Google Cloud Firestore Nodejs Library (ts-datastore-orm) stable release

The library comes to a stable release after 6months+ testinghttps://www.npmjs.com/package/ts-datastore-ormts-datastore-orm targets to provide a strong typed and structural ORM feature for Datastore (Firestore in Datastore mode).Some code snippets:​import {BaseEntity, Column, Entity, datastoreOrm} from "ts-datastore-orm"; datastoreOrm.addConnection("default", {keyFilename: "serviceAccount.json"}); datastoreOrm.addConnection("production", {clientEmail: "", privateKey: ""}); @Entity() export class User extends BaseEntity { @Column({generateId: true}) public id: number = 0; @Column({index: true}) public total: number = 0; } @Entity({kind: "User", connection: "production"}) export class User1 extends BaseEntity { @Column({generateId: true}) public id: number = 0; @Column({index: true}) public total: number = 0; } async function main() { const user = User.create(); await user.save(); const id = user.id; }

Submitted June 28, 2020 at 04:53AM by plk83

No comments:

Post a Comment