Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

feat(repository)!: count() & list_and_count() methods #276

Open
wants to merge 11 commits into
base: 0.30
Choose a base branch
from

Conversation

peterschutt
Copy link
Member

To support pagination that returns both a subset of the total query, and a count of records in the query.

The a select query is no longer created per repository instance, but rather is constructed per repository operation.
This change supports adding operations to the repository that may use a non-standard select query, while still making
available the utility methods for operating on the select query, e.g., filter_select_by_kwargs() and execute() methods
now require the select to be explicitly passed.

BREAKING CHANGE: select no longer bound to self on sqlalchemy repository.

peterschutt and others added 10 commits January 27, 2023 08:16
-  decouple the collection (select statement) from the repo instance

    E.g., the sqlalchemy select that represents the collection
    shouldn't need to be bound to `self`. This means that any
    operation can use the utility methods,like
    `filter_collection_by_kwargs()` without having to worry about
    modifying a pre-constructed select to do what it wants.
- make `list()` behave the same as it always did
- add `count()` methods as standalone service and repo ops.
- add `list_and_count()` methods as standalone service and repo ops.
@peterschutt peterschutt force-pushed the pagination-enhancements-ps branch from 8e3f00d to 80a3f3a Compare January 26, 2023 22:22
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

64.6% 64.6% Coverage
0.0% 0.0% Duplication

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants