@@ -25,7 +25,7 @@ export type TypeOrString<T> = (new () => T) | string;
2525
2626export type ExpressionOrColumn < TReturn , T > = ReturnExpression < TReturn , T > | string ;
2727
28- export type TypeWhere < T > = Expression < T > | ValueTypeToParse | ColumnRef | ProjectionsHelper < T > ;
28+ export type TypeWhere < T > = Expression < T > | ValueTypeToParse | ColumnRef | ProjectionsHelper < T > | PlanRef ;
2929
3030export type TypeProjection < T > = ProjectionsHelper < T > | ColumnRef | PlanRef ;
3131
@@ -43,6 +43,10 @@ export class Utils {
4343 return uuidv4 ( ) ;
4444 }
4545
46+ public static isFlag ( value : any , flag : any ) {
47+ return this . getDatabaseHelper ( ) . isFlag ( value , flag ) ;
48+ }
49+
4650 public static is ( value : any , type : string ) : boolean {
4751 return typeof value === type ;
4852 }
@@ -148,9 +152,11 @@ export class Utils {
148152 ? ExpressionOrValueEnum . Projection
149153 : this . isColumnRef ( value )
150154 ? ExpressionOrValueEnum . Ref
151- : this . isValue ( value )
152- ? ExpressionOrValueEnum . Value
153- : ExpressionOrValueEnum . Expression ;
155+ : this . isPlanRef ( value )
156+ ? ExpressionOrValueEnum . Plan
157+ : this . isValue ( value )
158+ ? ExpressionOrValueEnum . Value
159+ : ExpressionOrValueEnum . Expression ;
154160 }
155161
156162 public static getValueByTypeOrString < T > ( param : TypeOrString < T > ) : string {
@@ -180,14 +186,18 @@ export class Utils {
180186 column : ( expression as ColumnRef ) . result ( ) ,
181187 params : [ ]
182188 } ;
189+ case ( ExpressionOrValueEnum . Plan ) :
190+ return {
191+ column : ( expression as PlanRef ) . result ( ) ,
192+ params : [ ]
193+ } ;
183194 case ( ExpressionOrValueEnum . Value ) :
184195 return {
185196 column : "?" ,
186197 params : [ expression ]
187198 } ;
188199 case ( ExpressionOrValueEnum . Projection ) :
189200 const compiled = this . resolveExpressionProjection ( expression as ProjectionsHelper < T > ) ;
190- // const compiled = this.resolveProjection(expression as ProjectionsHelper<T>);
191201 return {
192202 column : compiled . projection ,
193203 params : compiled . params
@@ -200,19 +210,6 @@ export class Utils {
200210 }
201211 }
202212
203- // public static resolveProjection<T>(projection: TypeProjection<T>): ProjectionCompiled {
204- // if (this.isProjectionsHelper(projection)) {
205- // return (projection as ProjectionsHelper<T>)._compiled();
206- // }
207- // if (this.isColumnRef(projection)) {
208- // return new ProjectionCompiled((projection as ColumnRef).result());
209- // }
210- // if (this.isPlanRef(projection)) {
211- // return new ProjectionCompiled((projection as PlanRef).result());
212- // }
213- // return new ProjectionCompiled(projection + "");
214- // }
215-
216213 public static resolveExpressionProjection < TReturn , T > ( projection : ExpressionProjection < TReturn , T > ) : ProjectionCompiled {
217214 if ( this . isProjectionsHelper ( projection ) ) {
218215 return ( projection as ProjectionsHelper < T > ) . _compiled ( ) ;
@@ -223,10 +220,6 @@ export class Utils {
223220 if ( this . isPlanRef ( projection ) ) {
224221 return new ProjectionCompiled ( ( projection as PlanRef ) . result ( ) ) ;
225222 }
226- // const expressionOrColumn = this.expressionOrColumn(projection as ExpressionOrColumn<TReturn, T>);
227- // if(expressionOrColumn === ExpressionOrColumnEnum.Expression){
228- // return this.getColumn(projection as Expression)
229- // }
230223 return new ProjectionCompiled ( this . getColumn ( projection as ExpressionOrColumn < TReturn , T > ) ) ;
231224 }
232225
0 commit comments