Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function load_ljoin({
ready_sqls, add_column, tag, FxSQL_DEBUG,
connection_info, QUERY, VALUES, IN, NOT_IN, EQ, SET, COLUMN, CL, TABLE, TB, SQL, SQLS
}) {
const cmap = curry((f, arr) => Promise.all(arr.map(f)));
const table_columns = {};
const add_as_join = (me, as) =>
COLUMN(...go(
me.column.originals.concat(pluck('left_key', me.left_joins)),
map(c => me.as + '.' + c + ' AS ' + `${as}>_<${c}`),
uniq
));
Object.assign(table_columns, await go(
QUERY `
SELECT table_name, column_name
FROM information_schema.columns
WHERE
table_name in (
QUERY1,
ASSOCIATE,
ASSOCIATE1,
LJOIN: use_ljoin && ljoin ? await ljoin(QUERY) : null,
COMMIT: _ => COMMIT(client),
ROLLBACK: _ => ROLLBACK(client)
}
} catch (e) { throw e; }
}
}
}
return { CONNECT, VALUES, IN, NOT_IN, EQ, SET, COLUMN, CL, TABLE, TB, SQL, SQLS, FxSQL_DEBUG }
}
const method_promise = curry((name, obj) =>
new Promise((resolve, reject) =>
obj[name]((err, res) => err ? reject(err) : resolve(res))));
export const
PostgreSQL = BASE({
create_pool: connection_info => new pg.Pool(connection_info),
end_pool: pool => pool.end(),
query_fn: pool => pipe(pool.query.bind(pool), res => res.rows),
use_ljoin: true
}),
MySQL = BASE({
create_pool: connection_info => mysql.createPool(connection_info),