import moment from 'moment'; import { Entity } from '../entity'; import { Field } from '../selectable'; import { StringFilterFunction } from './string-filter-function'; import { BooleanFilterFunction } from './boolean-filter-function'; import { NumberFilterFunction } from './number-filter-function'; /** * Build a filter function to test whether a string ends with another. Evaluates to boolean. * @param str - The string to test. This can either be a string, a reference to a field or another filter function. * @param suffix - The suffix to test for. This can either be a string, a reference to a field or another filter function. * * @returns The newly created filter function */ export declare function endsWith(str: string | Field | StringFilterFunction, suffix: string | Field | StringFilterFunction): BooleanFilterFunction; /** * Build a filter function to test whether a string starts with another. Evaluates to boolean. * @param str - The string to test. This can either be a string, a reference to a field or another filter function. * @param prefix - The prefix to test for. This can either be a string, a reference to a field or another filter function. * * @returns The newly created filter function */ export declare function startsWith(str: string | Field | StringFilterFunction, prefix: string | Field | StringFilterFunction): BooleanFilterFunction; /** * Build a filter function to get the length of a string. Evaluates to int. * @param str - The string to compute the length for. This can either be a string, a reference to a field or another filter function. * @returns The newly created filter function */ export declare function length(str: string | Field | StringFilterFunction): NumberFilterFunction; /** * Build a filter function to get the start index of a substring. Evaluates to int. * @param str - The string to get the index from. This can either be a string, a reference to a field or another filter function. * @param substr - The substring to get the index for. This can either be a string, a reference to a field or another filter function. * * @returns The newly created filter function */ export declare function indexOf(str: string | Field | StringFilterFunction, substr: string | Field | StringFilterFunction): NumberFilterFunction; /** * Build a filter function to get a substring starting from a designated position. Evaluates to string. * @param str - The string to get a substring from. This can either be a string, a reference to a field or another filter function. * @param pos - The starting position of the substring. This can be either a number, a reference to a field or another filter function. * @param len - The length of the substring. This can be either a number, a reference to a field or another filter function. * @returns The newly created filter function */ export declare function substring(str: string | Field | StringFilterFunction, pos: number | Field | NumberFilterFunction, len?: number | Field | NumberFilterFunction): StringFilterFunction; /** * Build a filter function to transform a string to lower case. Evaluates to string. * @param str - The string to transform. This can either be a string, a reference to a field or another filter function. * @returns The newly created filter function */ export declare function toLower(str: string | Field | StringFilterFunction): StringFilterFunction; /** * Build a filter function to transform a string to upper case. Evaluates to string. * @param str - The string to transform. This can either be a string, a reference to a field or another filter function. * @returns The newly created filter function */ export declare function toUpper(str: string | Field | StringFilterFunction): StringFilterFunction; /** * Build a filter function to trim whitespace from a string. Evaluates to string. * @param str - The string to trim whitespace from. This can either be a string, a reference to a field or another filter function. * @returns The newly created filter function */ export declare function trim(str: string | Field | StringFilterFunction): StringFilterFunction; /** * Build a filter function to concatenate two strings. Evaluates to string. * @param str1 - The first string to concatenate. This can either be a string, a reference to a field or another filter function. * @param str2 - The second string to concatenate. This can either be a string, a reference to a field or another filter function. * @returns The newly created filter function */ export declare function concat(str1: string | Field | StringFilterFunction, str2: string | Field | StringFilterFunction): StringFilterFunction; /** * Build a filter function to round a number. Evaluates to double or decimal, defaults to double. * @param num - The number to round. This can either be a number, a reference to a field or another filter function. * @param returnType - The return type to use. * @returns The newly created filter function */ export declare function round(num: number | Field | NumberFilterFunction, returnType?: 'double' | 'decimal'): NumberFilterFunction; /** * Build a filter function to floor a number. Evaluates to double or decimal, defaults to double. * @param num - The number to floor. This can either be a number, a reference to a field or another filter function. * @param returnType - The return type to use. * @returns The newly created filter function */ export declare function floor(num: number | Field | NumberFilterFunction, returnType?: 'double' | 'decimal'): NumberFilterFunction; /** * Build a filter function to ceil a number. Evaluates to double or decimal, defaults to double. * @param num - The number to ceil. This can either be a number, a reference to a field or another filter function. * @param returnType - The return type to use. * @returns The newly created filter function */ export declare function ceiling(num: number | Field | NumberFilterFunction, returnType?: 'double' | 'decimal'): NumberFilterFunction; /** * Build a filter function to get the day of a date. Evaluates to int. * @param date - The date to get the day for. This can either be a date (Moment) or a reference to a field. * @returns The newly created filter function */ export declare function day(date: moment.Moment | Field): NumberFilterFunction; /** * Build a filter function to get the hour of a date. Evaluates to int. * @param date - The date to get the hour for. This can either be a date (Moment) or a reference to a field. * @returns The newly created filter function */ export declare function hour(date: moment.Moment | Field): NumberFilterFunction; /** * Build a filter function to get the minute of a date. Evaluates to int. * @param date - The date to get the minute for. This can either be a date (Moment) or a reference to a field. * @returns The newly created filter function */ export declare function minute(date: moment.Moment | Field): NumberFilterFunction; /** * Build a filter function to get the month of a date. Evaluates to int. * @param date - The date to get the month for. This can either be a date (Moment) or a reference to a field. * @returns The newly created filter function */ export declare function month(date: moment.Moment | Field): NumberFilterFunction; /** * Build a filter function to get the second of a date. Evaluates to int. * @param date - The date to get the second for. This can either be a date (moment.Moment) or a reference to a field. * @returns The newly created filter function */ export declare function second(date: moment.Moment | Field): NumberFilterFunction; /** * Build a filter function to get the year of a date. Evaluates to int. * @param date - The date to get the year for. This can either be a date (Moment) or a reference to a field. * @returns The newly created filter function */ export declare function year(date: moment.Moment | Field): NumberFilterFunction; /** * Build a filter function to test whether a selection is of a given type. Evaluates to boolean. * @param type - The type to test for, e. g. `API_BUSINESS_PARTNER.A_BusinessPartner`. * * @returns The newly created filter function */ export declare function isOf(type: string): BooleanFilterFunction; /** * Build a filter function to test whether a field is of a given type. Evaluates to boolean. * @param expression - A reference to a field to test for type. * @param type - The type to test for, e. g. `API_BUSINESS_PARTNER.A_BusinessPartner`. * * @returns The newly created filter function */ export declare function isOf(expression: Field, type: string): BooleanFilterFunction; /** * Filter functions common to both OData v2 and OData v4. See below for version specific filter functions. * Filter functions are used to create more complex filtering expressions, e. g. when filtering by the first letter of a property: * ``` * .filter(startsWith(BusinessPartner.FIRST_NAME, 'A').equals(true)) * ``` */ export declare const filterFunctions: { endsWith: typeof endsWith; startsWith: typeof startsWith; length: typeof length; indexOf: typeof indexOf; substring: typeof substring; toLower: typeof toLower; toUpper: typeof toUpper; trim: typeof trim; concat: typeof concat; round: typeof round; floor: typeof floor; ceiling: typeof ceiling; day: typeof day; hour: typeof hour; minute: typeof minute; month: typeof month; second: typeof second; year: typeof year; isOf: typeof isOf; }; //# sourceMappingURL=filter-functions.d.ts.map