Add fetch_if, related documention and refactor code slightly.

This commit is contained in:
Ege Emir Özkan
2020-08-03 04:43:13 +03:00
parent 6ce0613b4c
commit 77a6afdfd2
3 changed files with 45 additions and 15 deletions

View File

@@ -64,7 +64,11 @@ to check if it exists.)
Student(student_id=10, student_name='Albert Einstein')
```
Finally, we have two helper methods, `fetch_range(class_, range_)` and
`fetch_all(class_)` the former fetches the records fetchable from the object
id range provided by the user, whereas the latter fetches all records. Both
return a tuple of `class_` objects.
We have three helper methods, `fetch_range(class_, range_)` and
`fetch_all(class_)` are very similar: the former fetches the records
fetchable from the object id range provided by the user, whereas the
latter fetches all records. Both return a tuple of `class_` objects.
The last helper method, `fetch_if(class_, condition)` fetches all
the records of type `class_` that fit a certain condition. Here conditions
must be written is SQL syntax.