★ wanayoo — archive 1999 https://github.com/snorkypie/node-postgres-named-function-argumentsNouvelle recherche | Portail wanayoo
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

node-postgres-named-function-arguments

Build Status npm version

Named function arguments for node-postgres

Install with npm or Yarn:

# via npm
$ npm install node-postgres-named-function-arguments

# via yarn (automatically saves the package to your `dependencies` in package.json)
$ yarn add node-postgres-named-function-arguments

Usage

import nfa from 'node-postgres-named-function-arguments';
client.query(...nfa('get_user', { _username: 'snorkypie' }));

and

var nfa = require('node-postgres-named-function-arguments');
var sql = nfa('get_user', { _username: 'snorkypie' });
client.query(sql[0], sql[1]);

would be the same as...

client.query('select * from get_user(_username := $1)', [ 'snorkypie' ]);

Rationale

This package solves two major problems with a lot of the solutions out there.

  1. Target a specific overloaded function
  2. Target specific arguments where default values are used

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.