1 | import moment from 'moment';
|
2 | import { Entity } from '../entity';
|
3 | import { Field } from '../selectable';
|
4 | import { StringFilterFunction } from './string-filter-function';
|
5 | import { BooleanFilterFunction } from './boolean-filter-function';
|
6 | import { NumberFilterFunction } from './number-filter-function';
|
7 | /**
|
8 | * Build a filter function to test whether a string ends with another. Evaluates to boolean.
|
9 | * @param str - The string to test. This can either be a string, a reference to a field or another filter function.
|
10 | * @param suffix - The suffix to test for. This can either be a string, a reference to a field or another filter function.
|
11 | *
|
12 | * @returns The newly created filter function
|
13 | */
|
14 | export declare function endsWith<EntityT extends Entity>(str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>, suffix: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>): BooleanFilterFunction<EntityT>;
|
15 | /**
|
16 | * Build a filter function to test whether a string starts with another. Evaluates to boolean.
|
17 | * @param str - The string to test. This can either be a string, a reference to a field or another filter function.
|
18 | * @param prefix - The prefix to test for. This can either be a string, a reference to a field or another filter function.
|
19 | *
|
20 | * @returns The newly created filter function
|
21 | */
|
22 | export declare function startsWith<EntityT extends Entity>(str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>, prefix: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>): BooleanFilterFunction<EntityT>;
|
23 | /**
|
24 | * Build a filter function to get the length of a string. Evaluates to int.
|
25 | * @param str - The string to compute the length for. This can either be a string, a reference to a field or another filter function.
|
26 | * @returns The newly created filter function
|
27 | */
|
28 | export declare function length<EntityT extends Entity>(str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>): NumberFilterFunction<EntityT>;
|
29 | /**
|
30 | * Build a filter function to get the start index of a substring. Evaluates to int.
|
31 | * @param str - The string to get the index from. This can either be a string, a reference to a field or another filter function.
|
32 | * @param substr - The substring to get the index for. This can either be a string, a reference to a field or another filter function.
|
33 | *
|
34 | * @returns The newly created filter function
|
35 | */
|
36 | export declare function indexOf<EntityT extends Entity>(str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>, substr: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>): NumberFilterFunction<EntityT>;
|
37 | /**
|
38 | * Build a filter function to get a substring starting from a designated position. Evaluates to string.
|
39 | * @param str - The string to get a substring from. This can either be a string, a reference to a field or another filter function.
|
40 | * @param pos - The starting position of the substring. This can be either a number, a reference to a field or another filter function.
|
41 | * @param len - The length of the substring. This can be either a number, a reference to a field or another filter function.
|
42 | * @returns The newly created filter function
|
43 | */
|
44 | export declare function substring<EntityT extends Entity>(str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>, pos: number | Field<EntityT, boolean, boolean> | NumberFilterFunction<EntityT>, len?: number | Field<EntityT, boolean, boolean> | NumberFilterFunction<EntityT>): StringFilterFunction<EntityT>;
|
45 | /**
|
46 | * Build a filter function to transform a string to lower case. Evaluates to string.
|
47 | * @param str - The string to transform. This can either be a string, a reference to a field or another filter function.
|
48 | * @returns The newly created filter function
|
49 | */
|
50 | export declare function toLower<EntityT extends Entity>(str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>): StringFilterFunction<EntityT>;
|
51 | /**
|
52 | * Build a filter function to transform a string to upper case. Evaluates to string.
|
53 | * @param str - The string to transform. This can either be a string, a reference to a field or another filter function.
|
54 | * @returns The newly created filter function
|
55 | */
|
56 | export declare function toUpper<EntityT extends Entity>(str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>): StringFilterFunction<EntityT>;
|
57 | /**
|
58 | * Build a filter function to trim whitespace from a string. Evaluates to string.
|
59 | * @param str - The string to trim whitespace from. This can either be a string, a reference to a field or another filter function.
|
60 | * @returns The newly created filter function
|
61 | */
|
62 | export declare function trim<EntityT extends Entity>(str: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>): StringFilterFunction<EntityT>;
|
63 | /**
|
64 | * Build a filter function to concatenate two strings. Evaluates to string.
|
65 | * @param str1 - The first string to concatenate. This can either be a string, a reference to a field or another filter function.
|
66 | * @param str2 - The second string to concatenate. This can either be a string, a reference to a field or another filter function.
|
67 | * @returns The newly created filter function
|
68 | */
|
69 | export declare function concat<EntityT extends Entity>(str1: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>, str2: string | Field<EntityT, boolean, boolean> | StringFilterFunction<EntityT>): StringFilterFunction<EntityT>;
|
70 | /**
|
71 | * Build a filter function to round a number. Evaluates to double or decimal, defaults to double.
|
72 | * @param num - The number to round. This can either be a number, a reference to a field or another filter function.
|
73 | * @param returnType - The return type to use.
|
74 | * @returns The newly created filter function
|
75 | */
|
76 | export declare function round<EntityT extends Entity>(num: number | Field<EntityT, boolean, boolean> | NumberFilterFunction<EntityT>, returnType?: 'double' | 'decimal'): NumberFilterFunction<EntityT>;
|
77 | /**
|
78 | * Build a filter function to floor a number. Evaluates to double or decimal, defaults to double.
|
79 | * @param num - The number to floor. This can either be a number, a reference to a field or another filter function.
|
80 | * @param returnType - The return type to use.
|
81 | * @returns The newly created filter function
|
82 | */
|
83 | export declare function floor<EntityT extends Entity>(num: number | Field<EntityT, boolean, boolean> | NumberFilterFunction<EntityT>, returnType?: 'double' | 'decimal'): NumberFilterFunction<EntityT>;
|
84 | /**
|
85 | * Build a filter function to ceil a number. Evaluates to double or decimal, defaults to double.
|
86 | * @param num - The number to ceil. This can either be a number, a reference to a field or another filter function.
|
87 | * @param returnType - The return type to use.
|
88 | * @returns The newly created filter function
|
89 | */
|
90 | export declare function ceiling<EntityT extends Entity>(num: number | Field<EntityT, boolean, boolean> | NumberFilterFunction<EntityT>, returnType?: 'double' | 'decimal'): NumberFilterFunction<EntityT>;
|
91 | /**
|
92 | * Build a filter function to get the day of a date. Evaluates to int.
|
93 | * @param date - The date to get the day for. This can either be a date (Moment) or a reference to a field.
|
94 | * @returns The newly created filter function
|
95 | */
|
96 | export declare function day<EntityT extends Entity>(date: moment.Moment | Field<EntityT, boolean, boolean>): NumberFilterFunction<EntityT>;
|
97 | /**
|
98 | * Build a filter function to get the hour of a date. Evaluates to int.
|
99 | * @param date - The date to get the hour for. This can either be a date (Moment) or a reference to a field.
|
100 | * @returns The newly created filter function
|
101 | */
|
102 | export declare function hour<EntityT extends Entity>(date: moment.Moment | Field<EntityT, boolean, boolean>): NumberFilterFunction<EntityT>;
|
103 | /**
|
104 | * Build a filter function to get the minute of a date. Evaluates to int.
|
105 | * @param date - The date to get the minute for. This can either be a date (Moment) or a reference to a field.
|
106 | * @returns The newly created filter function
|
107 | */
|
108 | export declare function minute<EntityT extends Entity>(date: moment.Moment | Field<EntityT, boolean, boolean>): NumberFilterFunction<EntityT>;
|
109 | /**
|
110 | * Build a filter function to get the month of a date. Evaluates to int.
|
111 | * @param date - The date to get the month for. This can either be a date (Moment) or a reference to a field.
|
112 | * @returns The newly created filter function
|
113 | */
|
114 | export declare function month<EntityT extends Entity>(date: moment.Moment | Field<EntityT, boolean, boolean>): NumberFilterFunction<EntityT>;
|
115 | /**
|
116 | * Build a filter function to get the second of a date. Evaluates to int.
|
117 | * @param date - The date to get the second for. This can either be a date (moment.Moment) or a reference to a field.
|
118 | * @returns The newly created filter function
|
119 | */
|
120 | export declare function second<EntityT extends Entity>(date: moment.Moment | Field<EntityT, boolean, boolean>): NumberFilterFunction<EntityT>;
|
121 | /**
|
122 | * Build a filter function to get the year of a date. Evaluates to int.
|
123 | * @param date - The date to get the year for. This can either be a date (Moment) or a reference to a field.
|
124 | * @returns The newly created filter function
|
125 | */
|
126 | export declare function year<EntityT extends Entity>(date: moment.Moment | Field<EntityT, boolean, boolean>): NumberFilterFunction<EntityT>;
|
127 | /**
|
128 | * Build a filter function to test whether a selection is of a given type. Evaluates to boolean.
|
129 | * @param type - The type to test for, e. g. `API_BUSINESS_PARTNER.A_BusinessPartner`.
|
130 | *
|
131 | * @returns The newly created filter function
|
132 | */
|
133 | export declare function isOf<EntityT extends Entity>(type: string): BooleanFilterFunction<EntityT>;
|
134 | /**
|
135 | * Build a filter function to test whether a field is of a given type. Evaluates to boolean.
|
136 | * @param expression - A reference to a field to test for type.
|
137 | * @param type - The type to test for, e. g. `API_BUSINESS_PARTNER.A_BusinessPartner`.
|
138 | *
|
139 | * @returns The newly created filter function
|
140 | */
|
141 | export declare function isOf<EntityT extends Entity>(expression: Field<EntityT, boolean, boolean>, type: string): BooleanFilterFunction<EntityT>;
|
142 | /**
|
143 | * Filter functions common to both OData v2 and OData v4. See below for version specific filter functions.
|
144 | * Filter functions are used to create more complex filtering expressions, e. g. when filtering by the first letter of a property:
|
145 | * ```
|
146 | * .filter(startsWith(BusinessPartner.FIRST_NAME, 'A').equals(true))
|
147 | * ```
|
148 | */
|
149 | export declare const filterFunctions: {
|
150 | endsWith: typeof endsWith;
|
151 | startsWith: typeof startsWith;
|
152 | length: typeof length;
|
153 | indexOf: typeof indexOf;
|
154 | substring: typeof substring;
|
155 | toLower: typeof toLower;
|
156 | toUpper: typeof toUpper;
|
157 | trim: typeof trim;
|
158 | concat: typeof concat;
|
159 | round: typeof round;
|
160 | floor: typeof floor;
|
161 | ceiling: typeof ceiling;
|
162 | day: typeof day;
|
163 | hour: typeof hour;
|
164 | minute: typeof minute;
|
165 | month: typeof month;
|
166 | second: typeof second;
|
167 | year: typeof year;
|
168 | isOf: typeof isOf;
|
169 | };
|
170 | //# sourceMappingURL=filter-functions.d.ts.map |
\ | No newline at end of file |