Skip to content

Rename db Engines related functions#17481

Merged
wxiaoguang merged 5 commits into
go-gitea:mainfrom
lunny:lunny/rename_db_engines
Oct 30, 2021
Merged

Rename db Engines related functions#17481
wxiaoguang merged 5 commits into
go-gitea:mainfrom
lunny:lunny/rename_db_engines

Conversation

@lunny

@lunny lunny commented Oct 29, 2021

Copy link
Copy Markdown
Member

To make it not confusing, this PR renamed some functions related database Engine.

  • GetNewEngine -> NewEngine: this function will return a xorm.Engine as the first return parameter, so call it New is suitable.
  • SetEngine -> InitEngine: it will call the original GetNewEngine and assign engine to the db package variable x. So we call it Init.
  • NewEngine -> InitEngineWithMigration: the function will call SetEngine with some migration functions.
  • NewInstallTestEngine -> InitInstallEngineWithMigration: the function will call SetEngine with some test special statements.

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Oct 29, 2021
@codecov-commenter

codecov-commenter commented Oct 29, 2021

Copy link
Copy Markdown

Codecov Report

Merging #17481 (b305ba2) into main (0b4a8be) will increase coverage by 0.00%.
The diff coverage is 19.23%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #17481   +/-   ##
=======================================
  Coverage   45.47%   45.47%           
=======================================
  Files         791      791           
  Lines       88697    88702    +5     
=======================================
+ Hits        40335    40339    +4     
+ Misses      41850    41845    -5     
- Partials     6512     6518    +6     
Impacted Files Coverage Δ
cmd/cmd.go 44.18% <0.00%> (ø)
cmd/doctor.go 0.00% <0.00%> (ø)
cmd/dump.go 0.91% <0.00%> (ø)
cmd/migrate.go 0.00% <0.00%> (ø)
cmd/migrate_storage.go 0.00% <0.00%> (ø)
modules/doctor/dbconsistency.go 6.83% <0.00%> (ø)
modules/doctor/dbversion.go 42.85% <0.00%> (ø)
modules/doctor/doctor.go 12.24% <0.00%> (ø)
routers/install/install.go 0.66% <0.00%> (ø)
routers/web/feed/convert.go 0.00% <0.00%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f5bb788...b305ba2. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 29, 2021
@wxiaoguang

Copy link
Copy Markdown
Contributor

I like the idea to make these function names clear.

@lunny
lunny force-pushed the lunny/rename_db_engines branch from 09e39bf to da11426 Compare October 29, 2021 11:45
Comment thread models/db/engine.go Outdated
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 29, 2021
Comment thread models/db/engine.go Outdated
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Oct 29, 2021
@lunny
lunny force-pushed the lunny/rename_db_engines branch from ec3d3ce to b305ba2 Compare October 30, 2021 03:55
@wxiaoguang
wxiaoguang merged commit 63c0dc8 into go-gitea:main Oct 30, 2021
@lunny
lunny deleted the lunny/rename_db_engines branch October 30, 2021 15:45
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
* Rename db Engines related functions

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants