regexp
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
jusax23 2023-02-19 21:01:02 +01:00
parent 88321c76d1
commit cba4248727
2 changed files with 18 additions and 0 deletions

View file

@ -708,6 +708,23 @@ export class Handler {
}
return builder;
},
regexp: (handler: Handler, a: allModifierInput[]): QueryBuilder => {
const builder = new QueryBuilder();
if (a[0] instanceof Attribute || a[0] instanceof AttributeAlias) builder.addCode(a[0].toString());
else if (a[0] instanceof Modifier || a[0] instanceof selectQuery || a[0] instanceof Aggregation) {
builder.append(a[0].serialize(handler));
} else {
builder.addInjection(a[0]);
}
builder.addCode(" REGEXP ");
if (a[1] instanceof Attribute || a[1] instanceof AttributeAlias) builder.addCode(a[1].toString());
else if (a[1] instanceof Modifier || a[1] instanceof selectQuery || a[1] instanceof Aggregation) {
builder.append(a[1].serialize(handler));
} else {
builder.addInjection(a[1]);
}
return builder;
},
concat: (handler: Handler, a: allModifierInput[]): QueryBuilder => {
const builder = new QueryBuilder();
builder.addCode("CONCAT(");

View file

@ -18,6 +18,7 @@ export const divide = (...args: allModifierInput[]) => new NumberModifier("divid
export const not = (arg: allModifierInput) => new BooleanModifier("not", [arg]);
export const like = (a: allModifierInput, b: allModifierInput) => new BooleanModifier("like", [a, b]);
export const regexp = (a: allModifierInput, b: allModifierInput) => new BooleanModifier("regexp", [a, b]);
export const concat = (...args: allModifierInput[]) => new StringModifier("concat", args);