mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 15:06:01 +00:00
custom SQL condition #369
This commit is contained in:
@@ -72,5 +72,15 @@ export function dumpSqlCondition(dmp: SqlDumper, condition: Condition) {
|
||||
dumpSqlExpression(dmp, condition.expr);
|
||||
dmp.put(' ^in (%,v)', condition.values);
|
||||
break;
|
||||
case 'rawTemplate':
|
||||
let was = false;
|
||||
for (const item of condition.templateSql.split('$$')) {
|
||||
if (was) {
|
||||
dumpSqlExpression(dmp, condition.expr);
|
||||
}
|
||||
dmp.putRaw(item);
|
||||
was = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,12 @@ export interface InCondition {
|
||||
values: any[];
|
||||
}
|
||||
|
||||
export interface RawTemplateCondition {
|
||||
conditionType: 'rawTemplate';
|
||||
templateSql: string;
|
||||
expr: Expression;
|
||||
}
|
||||
|
||||
export type Condition =
|
||||
| BinaryCondition
|
||||
| NotCondition
|
||||
@@ -114,7 +120,8 @@ export type Condition =
|
||||
| ExistsCondition
|
||||
| NotExistsCondition
|
||||
| BetweenCondition
|
||||
| InCondition;
|
||||
| InCondition
|
||||
| RawTemplateCondition;
|
||||
|
||||
export interface Source {
|
||||
name?: NamedObjectInfo;
|
||||
|
||||
Reference in New Issue
Block a user