Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@evershop/postgres-query-builder
Advanced tools
A PostgreSQL query builder for NodeJS.
npm install @evershop/postgres-query-builder
It implements async/await.
const {select} = require('@evershop/postgres-query-builder')
const products = await select("*")
.from("product")
.where("product_id", ">", 1)
.execute(pool);
const {select} = require('@evershop/postgres-query-builder')
const products = await select("*")
.from("product")
.where("product_id", ">", 1)
.and("sku", "LIKE", "sku")
.execute(pool);
const {select} = require('@evershop/postgres-query-builder')
const query = select("*").from("product");
query.where("product_id", ">", 1).and("sku", "LIKE", "sku");
query.orWhere("price", ">", 100);
const products = await query.execute(pool);
const {select} = require('@evershop/postgres-query-builder')
const query = select("*").from("product");
query.leftJoin('price').on('product.`product_id`', '=', 'price.`product_id`');
query.where("product_id", ">", 1).and("sku", "LIKE", "sku");
query.andWhere("price", ">", 100);
const products = await query.execute(pool);
user_id | name | phone | status | |
---|---|---|---|---|
1 | David | emai@email.com | 123456 | 1 |
```javascript
const {insert} = require('@evershop/postgres-query-builder')
const query = insert("user")
.given({name: "David", email: "email@email.com", "phone": "123456", status: 1, notExistedColumn: "This will not be a part of the query"});
await query.execute(pool);
const {update} = require('@evershop/postgres-query-builder')
const query = update("user")
.given({name: "David", email: "email@email.com", "phone": "123456", status: 1, notExistedColumn: "This will not be a part of query"})
.where("user_id", "=", 1);
await query.execute(pool);
const { Pool } = require('pg');
const {insert, getConnection, startTransaction, commit, rollback} = require('@evershop/postgres-query-builder');
const pool = new Pool(connectionSetting);
// Create a connection from the pool
const connection = await getConnection(pool);
// Start a transaction
await startTransaction(connection);
try {
await insert("user")
.given({name: "David", email: "email@email.com", "phone": "123456", status: 1, notExistedColumn: "This will not be a part of the query"})
.execute(connection);
await commit(connection);
} catch(e) {
await rollback(connection);
}
All user provided data will be escaped.
FAQs
A PostgreSQL query builder for NodeJS
The npm package @evershop/postgres-query-builder receives a total of 1,725 weekly downloads. As such, @evershop/postgres-query-builder popularity was classified as popular.
We found that @evershop/postgres-query-builder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.