diff --git a/src/defaultHandler.ts b/src/defaultHandler.ts index d98d186..45394ff 100644 --- a/src/defaultHandler.ts +++ b/src/defaultHandler.ts @@ -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("); diff --git a/src/funcs.ts b/src/funcs.ts index e5e5ac3..b567b05 100644 --- a/src/funcs.ts +++ b/src/funcs.ts @@ -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);