Installation
npm install smn-pg
Use Example
config;
Only works on Node v6 and above.
Async methods, only works on Node v7 and above.
Check the operation list below.
INPUTS
EXECUTES < v.4
EXECUTES >= v.4
Example Config
let config = user: 'user' database: 'database' password: 'pass' host: 'host' port: 5432 max: 10 idleTimeoutMillis: 30000 schema?: 'schema default';; config schema: 'Schema default' ;// SINGLE INSTANCE
INPUTS
INPUT (parameter)
Params - Value
/* Inform the params in the same sequency of prcedure */ pg input'value' input'value' input'value' ;
Params - Name,Value
pg input'paramName1''value1' input'paramName2''value2' ;
Params - Object,Prefix
let obj = parameterName: 'parameterValue' parameterName1: 'parameterValue1' parameterName2: 'parameterValue2' /* The name of the attributes of the object must have the same name of the params. *//* The object must never have more attributes than params expected by the procedure *//* In the case have a prfix default, he can be past in the second params of the method */ pg inputobj /*Optional prefix name*/ input'paramName''value' /* Optional together with object */ ;
INPUTMANY (parameters)
pg ;
EXECUTES
EXECUTE (procedureName, callback)
Return list results
return pg ;
EXECUTEONE (procedureName, callback)
Return single result
return pg ;
ASYNC_EXECUTE (procedureName)
Return list results
return pg ;
ASYNC_EXECUTEONE (procedureName)
Return single result
return pg ;
EXECUTES * v.4 OR GREATER *
ASYNC_EXEC(procedureName, transacion?)
return pg
ASYNC_EXEC_ONE(procedureName, transacion?)
return pg