ddl-manager
Version:
store postgres procedures and triggers in files
25 lines (22 loc) • 418 B
text/typescript
import {
If,
Expression,
AbstractAstElement
} from "../../../../ast";
export function doIf(
condition: Expression | undefined,
doBlock: AbstractAstElement[]
) {
if ( !doBlock.length ) {
return [];
}
if ( !condition || condition.isEmpty() ) {
return doBlock;
}
return [new If({
if: condition,
then: [
...doBlock
]
})];
}