UNPKG

pg-mem

Version:

A memory version of postgres

61 lines 3.19 kB
import { IValue, _IIndex, _ISelection, _IType, _Transaction, _Explainer, _ExprExplanation, Parameter } from './interfaces-private'; import { nil, ArgDefDetails } from './interfaces'; import { QName } from 'pgsql-ast-parser'; export interface EvaluatorOptions { isAny?: boolean; isColumnOf?: _ISelection; /** its type will act as if it is a constant literal (for parameters type resolution) */ actAsConstantLiteral?: boolean; forceNotConstant?: boolean; onCast?: (to: _IType) => void; unpure?: boolean; } export declare class Evaluator<T = any> implements IValue<T> { readonly type: _IType<T>; readonly id: string | nil; readonly hash: string; val: nil | Object | number | string | Date | ((raw: any, transaction: _Transaction | nil) => any); private opts?; readonly isConstantLiteral: boolean; readonly usedColumns: Set<IValue<any>>; readonly forceNotConstant?: boolean; get index(): _IIndex | nil; get isConstant(): boolean; get isConstantReal(): boolean; origin: _ISelection | nil; get isAny(): boolean; constructor(type: _IType<T>, id: string | nil, hash: string, dependencies: IValue | IValue[] | nil, val: nil | Object | number | string | Date | ((raw: any, transaction: _Transaction | nil) => any), opts?: EvaluatorOptions | undefined); setType(type: _IType): Evaluator<T>; setConversion(converter: (val: T, t: _Transaction | nil) => any, hashConv: (hash: string) => any): Evaluator<T>; setOrigin(origin: _ISelection): IValue; clone(): Evaluator<T>; map<TNew>(mapper: (val: T) => TNew, newType?: _IType<TNew>): IValue<TNew>; setWrapper<TNew>(newOrigin: _ISelection, unwrap: (val: T) => TNew, newType?: _IType<TNew>): IValue<TNew>; setId(newId: string): IValue; get(): T; get(raw: any, t: _Transaction | nil): T; canCast(to: _IType<T>): boolean; cast<T = any>(to: _IType<T>): IValue; convertImplicit<T = any>(to: _IType<T>): IValue; explain(e: _Explainer): _ExprExplanation; } export declare const Value: { readonly null: (ofType?: _IType) => IValue; readonly text: (value: string, length?: number | nil) => IValue; readonly number: (value: number, type?: _IType<any>) => IValue; readonly function: (value: string | QName, args: IValue[]) => IValue; readonly bool: (value: boolean) => IValue; /** @deprecated Use with care */ readonly constant: (_type: _IType, value: any) => IValue; /** @deprecated Use with care */ readonly converter: (type: _IType, to: _IType) => (val: any, t: _Transaction | nil) => any; readonly in: (value: IValue, array: IValue, inclusive: boolean) => IValue; readonly isNull: (leftValue: IValue, expectNull: boolean) => IValue; readonly isTrue: (leftValue: IValue, expectTrue: boolean) => IValue; readonly isFalse: (leftValue: IValue, expectFalse: boolean) => IValue; readonly negate: (value: IValue) => IValue; readonly array: (values: IValue[]) => IValue; readonly list: (values: IValue[]) => IValue; }; export declare function buildParameterList(statementName: string | null, args: ArgDefDetails[]): Parameter[]; //# sourceMappingURL=evaluator.d.ts.map