# @lingua/pg-query

> Postgres query building utility

Latest version **0.0.1** (published 2016-12-29) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install @lingua/pg-query
pnpm add @lingua/pg-query
yarn add @lingua/pg-query
bun add @lingua/pg-query
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2016-12-29 |
| First published | 2016-12-29 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | James Brumond |
| Maintainers | lingua |

## Links

- npm: https://www.npmjs.com/package/@lingua/pg-query
- Repository: https://github.com/lingua-tech/pg-query
- Homepage: https://github.com/lingua-tech/pg-query#readme
- Issues: https://github.com/lingua-tech/pg-query/issues
- npm.io page: https://npm.io/package/@lingua/pg-query

## Dependencies (1)

- [pg](https://npm.io/package/pg.md) ^6.1.0

## Recent versions

- 0.0.1 (latest) — 2016-12-29

## README

Postgres query building utility

### Install

```bash
npm install --save git+ssh://git@github.com/lingua-service/pg-query.git
```

### Setup

```javascript
const pg      = require('pg-query');
const winston = require('winston');

const config = {
	host: 'localhost',
	port: 5432,
	database: 'db_name',
	user: 'username',
	password: 'secretpassword',
	maxClients: 10,
	idleTimeoutMillis: 30000,
};

const logger = new winston.Logger({
	transports: [
		new winston.transports.Console()
	]
});

pg.init(config, logger);
```

### Use

```javascript
const pg = require('pg-query');


// Raw query

pg.query('select * from some_table')
	.then((results) => {
		console.log(results);
	});


// Select query builder

const selectQuery = pg.select()
	.from('users')
	.where('name', '=', 'bob')
	.limit(20)
	.offset(10);

selectQuery.execute()
	.then((results) => {
		console.log(results);
	});


// Insert query builder

const insertQuery = pg.insert()
	.into('users')
	.values({
		name: 'bob',
		age: 23
	});

insertQuery.execute()
	.then((result) => {
		console.log(result);
	});


// Update query builder

const updateQuery = pg.update('users')
	.set('age', 24)
	.where('name', '=', 'bob');

updateQuery.execute()
	.then((result) => {
		console.log(result);
	});
```

---
_Source: https://npm.io/package/@lingua/pg-query · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
