1 | import { Entity } from '../entity';
|
2 | import { FieldType, OneToManyLink } from '../selectable';
|
3 | import { FilterLambdaExpression, BooleanFilterFunction, Filter, FilterLink, FilterList, UnaryFilter } from '../filter';
|
4 | /**
|
5 | * A union of all types that can be used for filtering.
|
6 | * @typeparam EntityT - Type of the entity to be filtered on
|
7 | */
|
8 | export declare type Filterable<EntityT extends Entity, LinkedEntityT extends Entity = any> = Filter<EntityT, FieldType | FieldType[]> | FilterLink<EntityT> | FilterList<EntityT> | FilterLambdaExpression<EntityT> | UnaryFilter<EntityT> | BooleanFilterFunction<EntityT> | OneToManyLink<EntityT, LinkedEntityT>;
|
9 | /**
|
10 | * Combine [[Filterable]]s with logical `and` to create a [[FilterList]].
|
11 | *
|
12 | * Example:
|
13 | * ```ts
|
14 | * Entity.requestBuilder()
|
15 | * .getAll()
|
16 | * .filter(and(filterExp1, filterExp2));
|
17 | * ```
|
18 | *
|
19 | * Note that the [[GetAllRequestBuilder.filter | GetAllRequestBuilderV2.filter]] and [[GetAllRequestBuilderV4.filter]] method take a rest parameter and thereby an array of filter expressions that are then combined conjunctively. As a consequence following is equivalent to the example above:
|
20 | * ```ts
|
21 | * Entity.requestBuilder()
|
22 | * .getAll()
|
23 | * .filter(filterExp1, filterExp2);
|
24 | * ```
|
25 | * @typeparam EntityT - Type of the entity filter on.
|
26 | * @param expressions - Filterables to be combined with logical `and`.
|
27 | * @returns The newly created FilterList.
|
28 | */
|
29 | export declare function and<EntityT extends Entity>(expressions: Filterable<EntityT>[]): FilterList<EntityT>;
|
30 | export declare function and<EntityT extends Entity>(...expressions: Filterable<EntityT>[]): FilterList<EntityT>;
|
31 | /**
|
32 | * Combine [[Filterable]]s with logical `or` to create a [[FilterList]].
|
33 | *
|
34 | * Example:
|
35 | * ```ts
|
36 | * Entity.requestBuilder()
|
37 | * .getAll()
|
38 | * .filter(or(filterExp1, filterExp2));
|
39 | * ```
|
40 | * @typeparam EntityT - Type of the entity filter on.
|
41 | * @param expressions - Filterables to be combined with logical `or`
|
42 | * @returns The newly created FilterList
|
43 | */
|
44 | export declare function or<EntityT extends Entity>(expressions: Filterable<EntityT>[]): FilterList<EntityT>;
|
45 | export declare function or<EntityT extends Entity>(...expressions: Filterable<EntityT>[]): FilterList<EntityT>;
|
46 | export declare function toFilterableList<EntityT extends Entity, LinkedEntityT extends Entity>(filters: Filterable<EntityT, LinkedEntityT>[]): Filterable<EntityT>[];
|
47 | /**
|
48 | * Negate a filter.
|
49 | * @param filter - The filter to negate.
|
50 | * @returns The negated filter.
|
51 | */
|
52 | export declare function not<EntityT extends Entity>(filter: Filterable<EntityT>): UnaryFilter<EntityT>;
|
53 | //# sourceMappingURL=filterable.d.ts.map |
\ | No newline at end of file |