# pg-require-sql

> Requires sql files and export functions for querying via pg

Latest version **1.0.0** (published 2015-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install pg-require-sql
pnpm add pg-require-sql
yarn add pg-require-sql
bun add pg-require-sql
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-07-17 |
| First published | 2015-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mike Atkins |
| Maintainers | apechimp |
| Keywords | pg, sql, require, postgres |

## Links

- npm: https://www.npmjs.com/package/pg-require-sql
- Repository: https://github.com/lanetix/node-pg-require-sql
- Issues: https://github.com/lanetix/node-pg-require-sql/issues
- npm.io page: https://npm.io/package/pg-require-sql

## Dependencies (2)

- [ramda](https://npm.io/package/ramda.md) ^0.16.0
- [camelize](https://npm.io/package/camelize.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2015-07-17
- 1.0.1-node-upgrade.0 (node-upgrade) — 2023-07-06
- 1.0.0-node-upgrade.0 — 2023-02-02

## README

pg-require-sql
==============
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
[![Circle CI](https://circleci.com/gh/lanetix/node-pg-require-sql.svg?style=svg)](https://circleci.com/gh/lanetix/node-pg-require-sql)
[![Dependency Status](https://david-dm.org/lanetix/node-pg-require-sql.svg)](https://david-dm.org/lanetix/node-pg-require-sql)

'Require' sql files for use with [pg-connect](https://www.npmjs.com/package/pg-connect).

Installation
------------
[![npm install --save pg-require-sql](https://nodei.co/npm/pg-require-sql.png)](https://npmjs.org/package/pg-require-sql)

Usage
-----

Given a project like
```
|- index.js
|- sql-directory
  |- get-record.sql
```

the following will query
```javascript
var Promise = require('bluebird')
var path = require('path')
var getConnection = require('pg-connect')(connectionString)
var requireSql = require('pg-require-sql')

var sql = requireSql(path.join(__dirname, 'sql-directory'))

Promise.using(
  getConnection(),
  sql.getRecord(['foo'])
).
then(function (results) {
  // ... use the results
})
```

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