0.1.0 • Published 2 years ago
electronade-pgstore v0.1.0
electronade-pgstore
It's a package for electronade that provides store feature using postgresql.
See electronade-pgstore.netlify.app for details.
Installation
npm install electronade-pgstore
What Exposed
electronade: {
pgstore: {
get: (
connectionString: string,
tableName: string,
id: string
) => Promise<any>;
getAll: (
connectionString: string;
tableName: string;
) => Promise<any[]>;
save: (
connectionString: string;
tableName: string;
item: object
) => Promise<any>;
remove: (
connectionString: string;
tableName: string;
id: string
) => Promise<any>;
}
}
Usage
See electronade usage for details.
const [
connectionString,
tableName,
] = [
"dummy connection string",
"dummyTable"
];
const item = await electronade.pgstore
.save(
connectionString,
tableName,
{ message: "hello" }
);
assert.equal(
await electronade.pgstore
.get(
connectionString,
tableName,
item._id
)
.then(({ message }) => message),
item.message
);
0.1.0
2 years ago