mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
🎨 fix format
This commit is contained in:
parent
9f39156994
commit
3bf34cffa9
|
@ -1,8 +1,4 @@
|
|||
import {
|
||||
ICredentialType,
|
||||
NodePropertyTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { ICredentialType, NodePropertyTypes } from 'n8n-workflow';
|
||||
|
||||
export class QuestDB implements ICredentialType {
|
||||
name = 'questdb';
|
||||
|
@ -59,7 +55,7 @@ export class QuestDB implements ICredentialType {
|
|||
{
|
||||
name: 'verify-full (not implemented)',
|
||||
value: 'verify-full',
|
||||
}
|
||||
},
|
||||
],
|
||||
default: 'disable',
|
||||
},
|
||||
|
|
|
@ -10,10 +10,7 @@ import pg = require('pg-promise/typescript/pg-subset');
|
|||
* @param {string[]} properties The properties it should include
|
||||
* @returns
|
||||
*/
|
||||
function getItemCopy(
|
||||
items: INodeExecutionData[],
|
||||
properties: string[],
|
||||
): IDataObject[] {
|
||||
function getItemCopy(items: INodeExecutionData[], properties: string[]): IDataObject[] {
|
||||
// Prepare the data to insert and copy it to be returned
|
||||
let newItem: IDataObject;
|
||||
return items.map(item => {
|
||||
|
@ -69,9 +66,7 @@ export async function pgInsert(
|
|||
): Promise<Array<IDataObject[]>> {
|
||||
const table = getNodeParam('table', 0) as string;
|
||||
const schema = getNodeParam('schema', 0) as string;
|
||||
let returnFields = (getNodeParam('returnFields', 0) as string).split(
|
||||
',',
|
||||
) as string[];
|
||||
let returnFields = (getNodeParam('returnFields', 0) as string).split(',') as string[];
|
||||
const columnString = getNodeParam('columns', 0) as string;
|
||||
const columns = columnString.split(',').map(column => column.trim());
|
||||
|
||||
|
@ -83,9 +78,7 @@ export async function pgInsert(
|
|||
const insertItems = getItemCopy(items, columns);
|
||||
|
||||
// Generate the multi-row insert query and return the id of new row
|
||||
returnFields = returnFields
|
||||
.map(value => value.trim())
|
||||
.filter(value => !!value);
|
||||
returnFields = returnFields.map(value => value.trim()).filter(value => !!value);
|
||||
const query =
|
||||
pgp.helpers.insert(insertItems, cs, te) +
|
||||
(returnFields.length ? ` RETURNING ${returnFields.join(',')}` : '');
|
||||
|
@ -127,11 +120,7 @@ export async function pgUpdate(
|
|||
|
||||
// Generate the multi-row update query
|
||||
const query =
|
||||
pgp.helpers.update(updateItems, columns, table) +
|
||||
' WHERE v.' +
|
||||
updateKey +
|
||||
' = t.' +
|
||||
updateKey;
|
||||
pgp.helpers.update(updateItems, columns, table) + ' WHERE v.' + updateKey + ' = t.' + updateKey;
|
||||
|
||||
// Executing the query to update the data
|
||||
await db.none(query);
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import { IExecuteFunctions } from 'n8n-core';
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
|
||||
import * as pgPromise from 'pg-promise';
|
||||
|
||||
|
@ -130,8 +125,7 @@ export class Postgres implements INodeType {
|
|||
},
|
||||
},
|
||||
default: '*',
|
||||
description:
|
||||
'Comma separated list of the fields that the operation will return',
|
||||
description: 'Comma separated list of the fields that the operation will return',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
|
@ -196,9 +190,7 @@ export class Postgres implements INodeType {
|
|||
database: credentials.database as string,
|
||||
user: credentials.user as string,
|
||||
password: credentials.password as string,
|
||||
ssl: !['disable', undefined].includes(
|
||||
credentials.ssl as string | undefined,
|
||||
),
|
||||
ssl: !['disable', undefined].includes(credentials.ssl as string | undefined),
|
||||
sslmode: (credentials.ssl as string) || 'disable',
|
||||
};
|
||||
|
||||
|
@ -222,12 +214,7 @@ export class Postgres implements INodeType {
|
|||
// insert
|
||||
// ----------------------------------
|
||||
|
||||
const [insertData, insertItems] = await pgInsert(
|
||||
this.getNodeParameter,
|
||||
pgp,
|
||||
db,
|
||||
items,
|
||||
);
|
||||
const [insertData, insertItems] = await pgInsert(this.getNodeParameter, pgp, db, items);
|
||||
|
||||
// Add the id to the data
|
||||
for (let i = 0; i < insertData.length; i++) {
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
import { IExecuteFunctions } from 'n8n-core';
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
|
||||
import * as pgPromise from 'pg-promise';
|
||||
|
||||
import {
|
||||
pgInsert,
|
||||
pgQuery,
|
||||
pgUpdate,
|
||||
} from '../Postgres/Postgres.node.functions';
|
||||
import { pgInsert, pgQuery, pgUpdate } from '../Postgres/Postgres.node.functions';
|
||||
|
||||
export class QuestDB implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
|
@ -134,8 +125,7 @@ export class QuestDB implements INodeType {
|
|||
},
|
||||
},
|
||||
default: '*',
|
||||
description:
|
||||
'Comma separated list of the fields that the operation will return',
|
||||
description: 'Comma separated list of the fields that the operation will return',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
|
@ -200,9 +190,7 @@ export class QuestDB implements INodeType {
|
|||
database: credentials.database as string,
|
||||
user: credentials.user as string,
|
||||
password: credentials.password as string,
|
||||
ssl: !['disable', undefined].includes(
|
||||
credentials.ssl as string | undefined,
|
||||
),
|
||||
ssl: !['disable', undefined].includes(credentials.ssl as string | undefined),
|
||||
sslmode: (credentials.ssl as string) || 'disable',
|
||||
};
|
||||
|
||||
|
@ -226,12 +214,7 @@ export class QuestDB implements INodeType {
|
|||
// insert
|
||||
// ----------------------------------
|
||||
|
||||
const [insertData, insertItems] = await pgInsert(
|
||||
this.getNodeParameter,
|
||||
pgp,
|
||||
db,
|
||||
items,
|
||||
);
|
||||
const [insertData, insertItems] = await pgInsert(this.getNodeParameter, pgp, db, items);
|
||||
|
||||
// Add the id to the data
|
||||
for (let i = 0; i < insertData.length; i++) {
|
||||
|
|
Loading…
Reference in a new issue