Skip to content

Commit 456e53b

Browse files
authored
Merge pull request #25 from febus982/add_cursor_pagination
Implement cursor based pagination
2 parents 7197b1c + 576bfe6 commit 456e53b

40 files changed

+1681
-395
lines changed

.github/workflows/python-3.10.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
poetry install --no-root --with dev
2828
- name: Test with pytest
2929
run: |
30-
pytest
30+
make ci-test
3131
- name: Check typing
3232
run: |
33-
mypy
33+
make typing

.github/workflows/python-3.11.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
poetry install --no-root --with dev
2828
- name: Test with pytest
2929
run: |
30-
pytest
30+
make ci-test
3131
- name: Check typing
3232
run: |
33-
mypy
33+
make typing

.github/workflows/python-3.8.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
poetry install --no-root --with dev
2828
- name: Test with pytest
2929
run: |
30-
pytest
30+
make ci-test
3131
- name: Check typing
3232
run: |
33-
mypy
33+
make typing

.github/workflows/python-3.9.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
poetry install --no-root --with dev
2828
- name: Test with pytest
2929
run: |
30-
pytest
30+
make ci-test
3131
- name: Check typing
3232
run: |
33-
mypy
33+
make typing

.github/workflows/python-code-style.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
python -m pip install --upgrade pip
2525
python -m pip install poetry
2626
poetry config virtualenvs.create false
27-
poetry install --no-root --with http,grpc,dev
27+
poetry install --no-root --with dev
2828
- name: Check code style with black
2929
run: |
30-
black --check sqlalchemy_bind_manager tests
30+
make format

.github/workflows/python-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ jobs:
2424
python -m pip install --upgrade pip
2525
python -m pip install poetry
2626
poetry config virtualenvs.create false
27-
poetry install --no-root --with http,grpc,dev
27+
poetry install --no-root --with dev
2828
- name: Lint with ruff
29-
uses: chartboost/ruff-action@v1
29+
run: make lint

.github/workflows/python-quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
env:
3131
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_REPORTER_ID }}
3232
with:
33-
coverageCommand: pytest --cov --cov-report lcov
33+
coverageCommand: make ci-coverage
3434
coverageLocations: |
3535
${{github.workspace}}/coverage.lcov:lcov
3636
debug: true

Makefile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1-
test: mypy
1+
test:
22
poetry run pytest -n auto --cov
33

4-
mypy:
4+
ci-test:
5+
poetry run pytest
6+
7+
ci-coverage:
8+
poetry run pytest --cov --cov-report lcov
9+
10+
typing:
511
poetry run mypy
612

713
format:
8-
poetry run black sqlalchemy_bind_manager tests
14+
poetry run black --check sqlalchemy_bind_manager tests
915

1016
lint:
17+
poetry run ruff .
18+
19+
format-fix:
20+
poetry run black sqlalchemy_bind_manager tests
21+
22+
lint-fix:
1123
poetry run ruff . --fix
24+
25+
dev-dependencies:
26+
poetry update --with dev
27+
28+
fix: format-fix lint-fix
29+
check: typing test format lint

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ to check [SQLAlchemy asyncio documentation](https://docs.sqlalchemy.org/en/20/or
178178
The `SQLAlchemyRepository` and `SQLAlchemyAsyncRepository` class can be used simply by extending them.
179179

180180
```python
181-
from sqlalchemy_bind_manager import SQLAlchemyRepository
181+
from sqlalchemy_bind_manager.repository import SQLAlchemyRepository
182182

183183

184184
class MyModel(model_declarative_base):
@@ -200,6 +200,7 @@ The classes provide some common use methods:
200200
* `delete`: Delete a model
201201
* `find`: Search for a list of models (basically an adapter for SELECT queries)
202202
* `paginated_find`: Search for a list of models, with pagination support
203+
* `cursor_paginated_find`: Search for a list of models, with cursor based pagination support
203204

204205
### Session lifecycle in repositories
205206

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ testpaths = [
6666

6767
[tool.mypy]
6868
files = "sqlalchemy_bind_manager"
69+
plugins = "pydantic.mypy"
6970

7071
[tool.ruff]
7172
select = ["E", "F", "I"]
7273

7374
[tool.ruff.per-file-ignores]
7475
"__init__.py" = ["F401"]
76+
"repository.py" = ["F401"]

0 commit comments

Comments
 (0)