add pagination method, add tests, update api docs, bump version, add release info

This commit is contained in:
collerek
2021-01-29 14:24:53 +01:00
parent 95385425fe
commit 4788394565
9 changed files with 209 additions and 4 deletions

View File

@ -94,7 +94,7 @@ to produce sqlalchemy.ForeignKeys
#### ForeignKey
```python
ForeignKey(to: Union[Type["Model"], "ForwardRef"], *, name: str = None, unique: bool = False, nullable: bool = True, related_name: str = None, virtual: bool = False, onupdate: str = None, ondelete: str = None, **kwargs: Any, ,) -> Any
ForeignKey(to: "ToType", *, name: str = None, unique: bool = False, nullable: bool = True, related_name: str = None, virtual: bool = False, onupdate: str = None, ondelete: str = None, **kwargs: Any, ,) -> Any
```
Despite a name it's a function that returns constructed ForeignKeyField.

View File

@ -24,7 +24,7 @@ pydantic field to use and type of the target column field.
#### ManyToMany
```python
ManyToMany(to: Union[Type["Model"], ForwardRef], through: Union[Type["Model"], ForwardRef], *, name: str = None, unique: bool = False, virtual: bool = False, **kwargs: Any, ,) -> Any
ManyToMany(to: "ToType", through: "ToType", *, name: str = None, unique: bool = False, virtual: bool = False, **kwargs: Any, ,) -> Any
```
Despite a name it's a function that returns constructed ManyToManyField.

View File

@ -444,6 +444,25 @@ each=True flag to affect whole table.
`(int)`: number of deleted rows
<a name="queryset.queryset.QuerySet.paginate"></a>
#### paginate
```python
| paginate(page: int, page_size: int = 20) -> "QuerySet"
```
You can paginate the result which is a combination of offset and limit clauses.
Limit is set to page size and offset is set to (page-1) * page_size.
**Arguments**:
- `page_size (int)`: numbers of items per page
- `page (int)`: page number
**Returns**:
`(QuerySet)`: QuerySet
<a name="queryset.queryset.QuerySet.limit"></a>
#### limit

View File

@ -416,6 +416,27 @@ Actual call delegated to QuerySet.
`(QuerysetProxy)`: QuerysetProxy
<a name="relations.querysetproxy.QuerysetProxy.paginate"></a>
#### paginate
```python
| paginate(page: int, page_size: int = 20) -> "QuerysetProxy"
```
You can paginate the result which is a combination of offset and limit clauses.
Limit is set to page size and offset is set to (page-1) * page_size.
Actual call delegated to QuerySet.
**Arguments**:
- `page_size (int)`: numbers of items per page
- `page (int)`: page number
**Returns**:
`(QuerySet)`: QuerySet
<a name="relations.querysetproxy.QuerysetProxy.limit"></a>
#### limit