Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function(groups) {
each(function(result) {
result._ = result._ || {};
result._[me.as] = (groups[result[me.left_key]] || []);
}, results);
return recur([me, cat(map(r => r._ ? r._[me.as] : null, results))]);
}
);
(query) => left.row_number.length == 2 ?
QUERY `
SELECT "--row_number_table--".*
FROM (
SELECT
${COLUMN(...cat(join_columns))},
ROW_NUMBER() OVER (PARTITION BY ${CL(left.as + '.' + left.key)} ORDER BY ${left.row_number[1]}) as "--row_number--"
FROM ${TB(left.table)} AS ${TB(left.as)}
${SQLS(join_sqls)}
${where_in || tag()}
${tag(query)}
) AS "--row_number_table--"
WHERE "--row_number_table--"."--row_number--"<=${left.row_number[0]}`
:
QUERY `
SELECT ${COLUMN(...cat(join_columns))}
FROM ${TB(left.table)} AS ${TB(left.as)}
${SQLS(join_sqls)}
${where_in || tag()}
${tag(query)}`,
left.row_number.length == 2 ? map(r => delete r['--row_number--'] && r) : r => r,