|
8 | 8 | Type-safe filter construction, datetime range filtering, collection-based filtering, |
9 | 9 | pagination support, search operations, and customizable ordering. |
10 | 10 |
|
11 | | -Example: |
12 | | - Basic usage with a datetime filter:: |
13 | | -
|
14 | | - import datetime |
15 | | - from advanced_alchemy.filters import BeforeAfter |
16 | | -
|
17 | | - filter = BeforeAfter( |
18 | | - field_name="created_at", |
19 | | - before=datetime.datetime.now(), |
20 | | - after=datetime.datetime(2023, 1, 1), |
21 | | - ) |
22 | | - statement = filter.append_to_statement(select(Model), Model) |
23 | | -
|
24 | 11 | Note: |
25 | 12 | All filter classes implement the :class:`StatementFilter` ABC, ensuring consistent |
26 | 13 | interface across different filter types. |
@@ -592,22 +579,6 @@ class ComparisonFilter(StatementFilter): |
592 | 579 |
|
593 | 580 | This filter applies basic comparison operators (=, !=, >, >=, <, <=) to a field. |
594 | 581 | It provides a generic way to perform common comparison operations. |
595 | | -
|
596 | | - Attributes: |
597 | | - ----------~ |
598 | | - field_name : str |
599 | | - Name of the model attribute to filter on |
600 | | - operator : str |
601 | | - Comparison operator to use ('eq', 'ne', 'gt', 'ge', 'lt', 'le') |
602 | | - value : Any |
603 | | - Value to compare against |
604 | | -
|
605 | | - Examples: |
606 | | - --------~ |
607 | | - >>> filter = SimpleFilter( |
608 | | - ... field_name="age", operator="gt", value=18 |
609 | | - ... ) |
610 | | - >>> statement = filter.append_to_statement(select(User), User) |
611 | 582 | """ |
612 | 583 |
|
613 | 584 | field_name: str |
@@ -953,17 +924,10 @@ class FilterGroup(StatementFilter): |
953 | 924 |
|
954 | 925 | This class combines multiple filters with a logical operator (AND/OR). |
955 | 926 | It provides a way to create complex nested filter conditions. |
956 | | -
|
957 | | - Attributes: |
958 | | - ----------~ |
959 | | - logical_operator : Callable[..., ColumnElement[bool]] |
960 | | - The SQLAlchemy operator to combine filters with (and_, or_) |
961 | | - filters : list[StatementFilter] |
962 | | - List of filters to apply |
963 | 927 | """ |
964 | 928 |
|
965 | 929 | logical_operator: Callable[..., ColumnElement[bool]] |
966 | | - """Logical operator to combine the filters (e.g., and_, or_).""" |
| 930 | + """Logical operator to combine the filters.""" |
967 | 931 | filters: list[StatementFilter] |
968 | 932 | """List of filters to combine.""" |
969 | 933 |
|
@@ -1029,13 +993,6 @@ class MultiFilter(StatementFilter): |
1029 | 993 | This filter provides a way to construct complex filter trees from |
1030 | 994 | a structured dictionary input, supporting nested logical groups and |
1031 | 995 | various filter types. |
1032 | | -
|
1033 | | - Attributes: |
1034 | | - ----------~ |
1035 | | - filters : dict[str, Any] |
1036 | | - Dictionary structure representing the filters, where keys can be |
1037 | | - logical operators ("and_", "or_") and values are lists of filter |
1038 | | - definitions. |
1039 | 996 | """ |
1040 | 997 |
|
1041 | 998 | filters: dict[str, Any] |
|
0 commit comments