n8n/packages/nodes-base/nodes/Snowflake/GenericFunctions.ts
कारतोफ्फेलस्क्रिप्ट™ 597669aa62
refactor(core): Move copyInputItems to node helpers (no-changelog) (#7299)
2023-10-06 16:25:58 +02:00

28 lines
711 B
TypeScript

import type snowflake from 'snowflake-sdk';
export async function connect(conn: snowflake.Connection) {
return new Promise<void>((resolve, reject) => {
conn.connect((error) => (error ? reject(error) : resolve()));
});
}
export async function destroy(conn: snowflake.Connection) {
return new Promise<void>((resolve, reject) => {
conn.destroy((error) => (error ? reject(error) : resolve()));
});
}
export async function execute(
conn: snowflake.Connection,
sqlText: string,
binds: snowflake.InsertBinds,
) {
return new Promise<any[] | undefined>((resolve, reject) => {
conn.execute({
sqlText,
binds,
complete: (error, stmt, rows) => (error ? reject(error) : resolve(rows)),
});
});
}