mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
Feature/paired item support (#3869)
* Add paired item helper and implement it in some nodes
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
|
||||
import pgPromise from 'pg-promise';
|
||||
|
||||
import { pgInsert, pgQuery, pgUpdate } from './Postgres.node.functions';
|
||||
import { pgInsert, pgInsertV2, pgQuery, pgQueryV2, pgUpdate } from './Postgres.node.functions';
|
||||
|
||||
export class Postgres implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -312,7 +312,7 @@ export class Postgres implements INodeType {
|
||||
|
||||
const db = pgp(config);
|
||||
|
||||
let returnItems = [];
|
||||
let returnItems: INodeExecutionData[] = [];
|
||||
|
||||
const items = this.getInputData();
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -322,33 +322,29 @@ export class Postgres implements INodeType {
|
||||
// executeQuery
|
||||
// ----------------------------------
|
||||
|
||||
const queryResult = await pgQuery(
|
||||
this.getNodeParameter,
|
||||
const queryResult = await pgQueryV2.call(
|
||||
this,
|
||||
pgp,
|
||||
db,
|
||||
items,
|
||||
this.continueOnFail(),
|
||||
);
|
||||
|
||||
returnItems = this.helpers.returnJsonArray(queryResult);
|
||||
returnItems = queryResult as INodeExecutionData[];
|
||||
} else if (operation === 'insert') {
|
||||
// ----------------------------------
|
||||
// insert
|
||||
// ----------------------------------
|
||||
|
||||
const insertData = await pgInsert(
|
||||
this.getNodeParameter,
|
||||
const insertData = await pgInsertV2.call(
|
||||
this,
|
||||
pgp,
|
||||
db,
|
||||
items,
|
||||
this.continueOnFail(),
|
||||
);
|
||||
|
||||
for (let i = 0; i < insertData.length; i++) {
|
||||
returnItems.push({
|
||||
json: insertData[i],
|
||||
});
|
||||
}
|
||||
// returnItems = this.helpers.returnJsonArray(insertData);
|
||||
returnItems = insertData as INodeExecutionData[];
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
|
||||
Reference in New Issue
Block a user