Fix query when filtering by bigint type field (#268)

This commit is contained in:
nikugogoi 2021-10-14 17:19:25 +05:30 committed by GitHub
parent e0933f10b2
commit 3b27177389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -382,7 +382,7 @@ export class Database {
Object.entries(where).forEach(([field, filters]) => {
filters.forEach((filter, index) => {
// Form the where clause.
const { not, operator, value } = filter;
let { not, operator, value } = filter;
const columnMetadata = repo.metadata.findColumnWithPropertyName(field);
assert(columnMetadata);
let whereClause = `${tableName}.${columnMetadata.propertyAliasName} `;
@ -402,6 +402,9 @@ export class Database {
} else if (operator === 'in') {
whereClause += '(:...';
} else {
// Convert to string type value as bigint type throws error in query.
value = value.toString();
whereClause += ':';
}