Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use db queryset to reduce duplicated code #1652

Merged
merged 5 commits into from
Jun 17, 2024

Conversation

waketzheng
Copy link
Contributor

Description

There are server repeat code segments in tortoise/models.py as follows:

db = using_db or cls._choose_db()
cls._meta.manager.get_queryset().using_db(db)

Motivation and Context

Add a new classmethod _db_queryset to Model

How Has This Been Tested?

make ci

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@coveralls
Copy link

coveralls commented Jun 14, 2024

Pull Request Test Coverage Report for Build 9513948759

Details

  • 14 of 14 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.003%) to 88.944%

Totals Coverage Status
Change from base Build 9479020180: -0.003%
Covered Lines: 5853
Relevant Lines: 6481

💛 - Coveralls

tortoise/models.py Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jun 16, 2024

Pull Request Test Coverage Report for Build 9537193587

Details

  • 15 of 15 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.004%) to 89.049%

Totals Coverage Status
Change from base Build 9534241702: -0.004%
Covered Lines: 5868
Relevant Lines: 6492

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 16, 2024

Pull Request Test Coverage Report for Build 9537259684

Details

  • 15 of 15 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.004%) to 89.049%

Totals Coverage Status
Change from base Build 9534241702: -0.004%
Covered Lines: 5868
Relevant Lines: 6492

💛 - Coveralls

@abondar abondar merged commit 3568aea into tortoise:develop Jun 17, 2024
7 checks passed
@waketzheng waketzheng deleted the optimize-model branch June 24, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants