Query
query ¶
Query the database for pages.
And ¶
Condition ¶
Base class for filter query conditions.
is_method: bool = False class-attribute instance-attribute ¶
__and__(other: Condition) -> Condition ¶
__iand__(other: Condition) -> Condition ¶
__ior__(other: Condition) -> Condition ¶
__or__(other: Condition) -> Condition ¶
__repr__() -> str abstractmethod ¶
__str__() -> str ¶
create_obj_ref(db: Database) -> obj_query.QueryFilter abstractmethod ¶
Contains ¶
DateCondition ¶
InEquality ¶
IsEmpty ¶
NextMonth ¶
NextWeek ¶
NextYear ¶
Or ¶
PageProperty ¶
Represents a property of a page.
Note
We override some magic methods to allow for more natural query building in an unorthodox way. Be aware that for instance the comparison operator == will not return boolean values but instances of the corresponding condition classes.
any: RollupArrayProperty property ¶
every: RollupArrayProperty property ¶
name: str instance-attribute ¶
none: RollupArrayProperty property ¶
sort: SortDirection = Field(default=(SortDirection.ASCENDING)) class-attribute instance-attribute ¶
__eq__(other: Any) -> Condition ¶
__ge__(value: Any) -> Condition ¶
__gt__(value: Any) -> Condition ¶
__hash__() -> int ¶
__le__(value: Any) -> Condition ¶
__lt__(value: Any) -> Condition ¶
__ne__(other: Any) -> Condition ¶
__repr__() -> str ¶
__str__() -> str ¶
asc() -> Self ¶
contains(value: str | User | Page | Option) -> Condition ¶
desc() -> Self ¶
does_not_contain(value: str | User | Page | Option) -> Condition ¶
ends_with(value: str) -> Condition ¶
is_empty() -> Condition ¶
is_not_empty() -> Condition ¶
next_month() -> Condition ¶
next_week() -> Condition ¶
next_year() -> Condition ¶
past_month() -> Condition ¶
past_week() -> Condition ¶
past_year() -> Condition ¶
starts_with(value: str) -> Condition ¶
this_week() -> Condition ¶
PastMonth ¶
PastWeek ¶
PastYear ¶
Query(database: Database) ¶
A query object to filter and sort pages in a database.
database: Database = database instance-attribute ¶
__repr__() -> str ¶
__str__() -> str ¶
execute() -> View ¶
Execute the query and return the resulting pages as a view.
filter(expr: Condition) -> Query ¶
Filter the query by the given properties.
Note
The filter is applied as an AND operation with the existing filter.
sort(*props: PageProperty | str) -> Query ¶
Sort the query by the given properties and directions.
Note
The order of the properties is important. The first property is the primary sort, the second is the secondary sort, and so on. Calling this method multiple times will overwrite the previous sorts.
RollupArrayProperty ¶
StartsWith ¶
ThisWeek ¶
prop(prop_name: str) -> PageProperty ¶
Create a property object.