Typescript migration

* db/database.js
* utils/databaseUtil.js
This commit is contained in:
baldo 2020-04-08 22:05:53 +02:00
parent c91d892780
commit 9e29eb924e
6 changed files with 67 additions and 42 deletions

View file

@ -1,12 +0,0 @@
'use strict';
const _ = require('lodash')
module.exports = {
inCondition (field, list) {
return {
query: '(' + field + ' IN (' + _.join(_.times(list.length, _.constant('?')), ', ') + '))',
params: list
}
}
}

View file

@ -0,0 +1,8 @@
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,
}
}