-
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.
Switch to ts version of expr compiler
- Loading branch information
Showing
11 changed files
with
4,368 additions
and
5,069 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,65 @@ | ||
import { JsonQLExpr, JsonQLFrom } from "jsonql"; | ||
import Schema from "./Schema"; | ||
import { Expr, Variable } from "./types"; | ||
|
||
import { BuildEnumsetExpr, CaseExpr, Column, Expr, FieldExpr, LegacyComparisonExpr, LegacyLogicalExpr, OpExpr, ScalarExpr, ScoreExpr, Variable, VariableExpr } from "./types"; | ||
/** Compiles expressions to JsonQL. Assumes that geometry is in Webmercator (3857) */ | ||
export default class ExprCompiler { | ||
constructor(schema: Schema, variables?: Variable[], variableValues?: { [variableId: string]: Expr }) | ||
|
||
compileExpr(options: { expr: Expr, tableAlias: string }): JsonQLExpr | ||
compileTable(table: string, alias: string): JsonQLFrom | ||
schema: Schema; | ||
variables: Variable[]; | ||
variableValues: { | ||
[variableId: string]: Expr; | ||
}; | ||
constructor(schema: Schema, variables?: Variable[], variableValues?: { | ||
[variableId: string]: Expr; | ||
}); | ||
/** Compile an expression. Pass expr and tableAlias. */ | ||
compileExpr(options: { | ||
expr: Expr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
/** Compile a field expressions */ | ||
compileFieldExpr(options: { | ||
expr: FieldExpr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
compileScalarExpr(options: { | ||
expr: ScalarExpr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
/** Compile a join into an on or where clause | ||
* fromTableID: column definition | ||
* joinColumn: column definition | ||
* fromAlias: alias of from table | ||
* toAlias: alias of to table | ||
*/ | ||
compileJoin(fromTableId: string, joinColumn: Column, fromAlias: string, toAlias: string): any; | ||
compileOpExpr(options: { | ||
expr: OpExpr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
compileCaseExpr(options: { | ||
expr: CaseExpr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
compileScoreExpr(options: { | ||
expr: ScoreExpr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
compileBuildEnumsetExpr(options: { | ||
expr: BuildEnumsetExpr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
compileComparisonExpr(options: { | ||
expr: LegacyComparisonExpr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
compileLogicalExpr(options: { | ||
expr: LegacyLogicalExpr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
compileColumnRef(column: any, tableAlias: string): JsonQLExpr; | ||
compileTable(tableId: string, alias: string): JsonQLFrom; | ||
compileVariableExpr(options: { | ||
expr: VariableExpr; | ||
tableAlias: string; | ||
}): JsonQLExpr; | ||
} |
Oops, something went wrong.