npm.io
0.0.6 • Published 8 years ago

pg-concat

Licence
MIT
Version
0.0.6
Deps
4
Size
4 kB
Vulns
9
Weekly
0
Stars
121
DeprecatedThis package is deprecated

pg-concat

JavaScript Style Guide license

Takes an array of parts and returns the necessary PostgreSQL expression to concatenate them.

Usage

const pgConcat = require('pg-concat')

const concatString = pgConcat(
    [
        { columnName: 'incident_no' },
        '/',
        { columnName: 'year', default: 1900 },
    ]
)

// concatString = 'incident_no||'/'||COALESCE(year, 1900)'

Install

$ npm install pg-concat --save

License

MIT

Keywords