chore(postgresql): rename app folder and add icon

This commit is contained in:
Ali BARIN
2023-05-09 19:37:06 +00:00
parent 0c8343e76f
commit f29ccace2a
19 changed files with 214 additions and 263 deletions

View File

@@ -0,0 +1,20 @@
import knex, { Knex } from 'knex';
import { IGlobalVariable } from '@automatisch/types';
const getClient = ($: IGlobalVariable): Knex<any, unknown[]> => {
const pgClient = knex({
client: 'pg',
version: $.auth.data.version as string,
connection: {
host: $.auth.data.host as string,
port: Number($.auth.data.port),
user: $.auth.data.user as string,
password: $.auth.data.password as string,
database: $.auth.data.database as string,
}
})
return pgClient;
};
export default getClient;

View File

@@ -0,0 +1,16 @@
import { Knex } from 'knex';
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
const setParams = async ($: IGlobalVariable, client: Knex<any, unknown[]>): Promise<Knex.Raw<any>> => {
const params: any = $.step.parameters.params
let paramsObj: IJSONObject = {}
params.forEach((ele: any) => { paramsObj[ele.configParam] = ele.value })
for (const key in paramsObj) {
const res = await client.raw(`SET ${key} = '${paramsObj[key]}'`);
}
};
export default setParams;