fix: 🐛 Add support for not equals in MQL expression parsing (#2029)

This commit is contained in:
Zhihe Li committed 2024-01-16 10:17:45 -05:00
1 parent 50e4a2adbc
commit dfd484dbca
1 file changed
+5
+5
View File
@@ -45,6 +45,8 @@ export function generateMQLFilterExpression(filterObj) {
return lt(key, value);
case 'lte':
return lte(key, value);
case 'notEquals':
return notEquals(key, value);
default:
return equals(key, value);
}
@@ -105,6 +107,9 @@ const sanitize = (input) => input?.replace(/(["\\])/g, '\\$1');
const equals = (key, value) =>
!isEmpty(value) ? `${key} = "${sanitize(value)}"` : null;
const notEquals = (key, value) =>
!isEmpty(value) ? `${key} != "${sanitize(value)}"` : null;
const contains = (key, value) =>
!isEmpty(value) ? `${key} % "${sanitize(value)}"` : null;