electronade-pgstore-util
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

electronade-pgstore-util

It's a package that provides some utilities for electronade-pgstore.
See electronade-pgstore-util.netlify.app also.

It's an optional module for electronade-pgstore so electronade-pgstore should be installed before using electronade-pgstore-util.

npm NPM npms.io (quality) Libraries.io dependency status for latest release Maintenance

Installation

npm install electronade-pgstore-util

Interfaces

class PgStore {
  constructor(connectionString: string, tableName: string, exposedName?: string);
  public getAll() => Promise<any>;
  public get(id: string) => Promise<any>;
  public save(item: object) => Promise<object>;
  public remove(id: string) => Promise<boolean>;
}

Usage

import and use PgStore class in Renderer process.

import { PgStore } from "electronade-pgstore-util";

const store = new PgStore(
  "postgres://...",
  "tableName"
);

const item = await store.save({ name: "test" });

console.log(item); // { _id: "xxx", name: "test" }

console.log(
  await store.get(item.id)
); // { _id: "xxx", name: "test" }


console.log(
  await store.getAll()
); // [{ _id: "xxx", name: "test" }]

console.log(
  await store.remove(item._id)
); // true

Readme

Keywords

Package Sidebar

Install

npm i electronade-pgstore-util

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

7.64 kB

Total Files

5

Last publish

Collaborators

  • tomsd