chore(postgresql): rename app folder and add icon
This commit is contained in:
@@ -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;
|
@@ -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;
|
Reference in New Issue
Block a user