mirror of
https://github.com/dbgate/dbgate
synced 2024-11-08 04:35:58 +00:00
16 lines
479 B
TypeScript
16 lines
479 B
TypeScript
import { SqlDumper } from '@dbgate/types';
|
|
import { Condition, BinaryCondition } from './types';
|
|
import { dumpSqlExpression } from './dumpSqlExpression';
|
|
|
|
export function dumpSqlCondition(dmp: SqlDumper, condition: Condition) {
|
|
switch (condition.conditionType) {
|
|
case 'binary':
|
|
dmp.put('(');
|
|
dumpSqlExpression(dmp, condition.left);
|
|
dmp.put(' %s ', condition.operator);
|
|
dumpSqlExpression(dmp, condition.right);
|
|
dmp.put(')');
|
|
break;
|
|
}
|
|
}
|