import { EntityBase } from '../entity-base' ; import { BooleanFilterFunction } from './boolean-filter-function' ; import { NumberFilterFunction } from './number-filter-function' ; import { StringFilterFunction } from './string-filter-function' ; import { FilterFunctionParameterType } from './filter-function-base' ; internal export function filterFunction < EntityT extends EntityBase > ( functionName , returnType , ... parameters ) ; internal export function filterFunction < EntityT extends EntityBase > ( functionName , returnType , ... parameters ) ; internal export function filterFunction < EntityT extends EntityBase > ( functionName , returnType , ... parameters ) ; param functionName param returnType param parameters returns internal export function filterFunction < EntityT extends EntityBase > ( functionName , returnType , ... parameters ) { return createFilterFunction ( functionName , returnType , ... parameters ) ; } param functionName param returnType param parameters returns internal export function createFilterFunction < EntityT extends EntityBase > ( functionName , returnType , ... parameters ) { switch ( returnType ) { case 'boolean' : return new BooleanFilterFunction ( functionName , parameters ) ; case 'string' : return new StringFilterFunction ( functionName , parameters ) ; case 'int' : case 'double' : case 'decimal' : return new NumberFilterFunction ( functionName , parameters , numberReturnTypeMapping [ returnType ] ) ; } } internal export const numberReturnTypeMapping = { int : 'Edm.Int32' , double : 'Edm.Double' , decimal : 'Edm.Decimal' } ; internal export type FilterFunctionReturnType = 'boolean' | 'int' | 'double' | 'decimal' | 'string' ;