mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
fix mapfilter / rawquery for relational
This commit is contained in:
parent
7df142b02b
commit
d6c8f3aa18
@ -66,7 +66,7 @@ function getDateFormat(date) {
|
||||
function mapFilter(column, operator, name, type = 'String') {
|
||||
switch (operator) {
|
||||
case OPERATORS.equals:
|
||||
return `${column} = {${name}:${type}`;
|
||||
return `${column} = {${name}:${type}}`;
|
||||
case OPERATORS.notEquals:
|
||||
return `${column} != {${name}:${type}}`;
|
||||
default:
|
||||
|
@ -92,12 +92,12 @@ function getTimestampIntervalQuery(field: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
function mapFilter(column, operator, name, type = 'String') {
|
||||
function mapFilter(column, operator, name, type = 'varchar') {
|
||||
switch (operator) {
|
||||
case OPERATORS.equals:
|
||||
return `${column} = {${name}:${type}`;
|
||||
return `${column} = {{${name}::${type}}}`;
|
||||
case OPERATORS.notEquals:
|
||||
return `${column} != {${name}:${type}}`;
|
||||
return `${column} != {{${name}::${type}}}`;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
@ -161,7 +161,7 @@ async function rawQuery(sql: string, data: object): Promise<any> {
|
||||
return Promise.reject(new Error('Unknown database.'));
|
||||
}
|
||||
|
||||
const query = sql?.replaceAll(/\{\{\s*(\w+)(::\w+)?\s*}}/g, (...args) => {
|
||||
const query = sql?.replaceAll(/\{\{\s*(\w+)(::\w+)?\s*\}\}/g, (...args) => {
|
||||
const [, name, type] = args;
|
||||
params.push(data[name]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user