MCPcopy Create free account
hub / github.com/bytebase/bytebase / resolveStringExpr

Function resolveStringExpr

frontend/src/plugins/cel/logic/resolve.ts:200–219  ·  view source on GitHub ↗
(
  expr: CELExpr,
  negative: boolean = false
)

Source from the content-addressed store, hash-verified

198};
199
200const resolveStringExpr = (
201 expr: CELExpr,
202 negative: boolean = false
203): StringExpr => {
204 const callExpr =
205 expr.exprKind?.case === "callExpr" ? expr.exprKind.value : null;
206 if (!callExpr)
207 throw new Error(`Expected callExpr but got ${expr.exprKind?.case}`);
208 let operator = callExpr.function as StringOperator;
209 if (negative && operator === "contains") {
210 operator = "@not_contains";
211 }
212 const factor = getFactorName(callExpr.target!);
213 const value = callExpr.args[0];
214 return {
215 type: ExprType.Condition,
216 operator,
217 args: [factor as StringFactor, getConstantStringValue(value)],
218 };
219};
220
221const resolveCollectionExpr = (
222 expr: CELExpr,

Callers 1

dfsFunction · 0.85

Calls 2

getFactorNameFunction · 0.85
getConstantStringValueFunction · 0.85

Tested by

no test coverage detected