Query¶
A file containing the implementation of the Query and Condition classes for filtering and querying data
- class lightdb.query.Condition(field: Field, op: str, value: Any)[source]¶
Bases:
objectA class representing a condition in a database query
- class lightdb.query.Query(model: MODEL)[source]¶
Bases:
objectA class representing a database query
- evaluate_conditions(model: MODEL) bool[source]¶
Evaluate the conditions for a given model
- Params:
model (
Model): The model to evaluate the conditions against- Returns:
bool: True if all conditions are met, False otherwise
- execute() List[MODEL][source]¶
Execute the query and return the filtered results
- Returns:
`List[Model]`: The filtered results of the query
- where(*conditions: List[Condition], **filters: Dict[str, Any]) Query[source]¶
Add a condition to the query
- Params:
condition (
Condition): The conditions to add to the queryfilters (
Dict[str, Any]): Keyword arguments representing filter criteria for the model instances- Returns:
Query: The updated query object