-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
2,377 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import Schema from "./Schema"; | ||
import { Variable, AggrStatus, Expr, LocalizedString, FieldExpr, EnumValue } from "./types"; | ||
|
||
export default class ExprUtils { | ||
constructor(schema: Schema, variables?: Variable[]) | ||
|
||
summarizeExpr(expr: Expr, locale?: string): string | ||
|
||
getExprType(expr: Expr): string | null | ||
|
||
getExprAggrStatus(expr: Expr): AggrStatus | null | ||
|
||
getExprEnumValues(expr: Expr): EnumValue[] | null | ||
|
||
/** Gets the id table of an expression of type id */ | ||
getExprIdTable(expr: Expr): string | null | ||
|
||
/** Converts a literal value related to an expression to a string, using name of enums. preferEnumCodes tries to use code over name */ | ||
stringifyExprLiteral(expr: Expr, literal: any, locale?: string, preferEnumCodes?: boolean): string | ||
|
||
/** Localize a localized string */ | ||
static localizeString(str?: LocalizedString | null, locale?: string): string | ||
|
||
/** Localize a localized string */ | ||
localizeString(str?: LocalizedString | null, locale?: string): string | ||
|
||
/** Get a list of fields that are referenced in a an expression | ||
* Useful to know which fields and joins are used. Includes joins as fields */ | ||
getReferencedFields(expr: Expr): FieldExpr[] | ||
|
||
/** Replace variables with literal values */ | ||
inlineVariableValues(expr: Expr, variableValues: { [variableId: string]: any }): Expr | ||
|
||
/** Determine if op is aggregate */ | ||
static isOpAggr(op: string): boolean | ||
|
||
/** Determine if op is prefix */ | ||
static isOpPrefix(op: string): boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.