ffffng/server/utils/databaseUtil.ts
baldo 9e29eb924e Typescript migration
* db/database.js
* utils/databaseUtil.js
2020-04-08 22:05:53 +02:00

9 lines
256 B
TypeScript

import _ from "lodash";
export function inCondition<T>(field: string, list: T[]): {query: string, params: T[]} {
return {
query: '(' + field + ' IN (' + _.join(_.times(list.length, _.constant('?')), ', ') + '))',
params: list,
}
}