[PR #2628] [MERGED] Use AfterLoad instead of AfterSet on Structs #16512

Closed
opened 2025-11-02 12:12:21 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/2628
Author: @lunny
Created: 9/30/2017
Status: Merged
Merged: 10/1/2017
Merged by: @lafriks

Base: masterHead: lunny/use_afterload


📝 Commits (5)

  • 3cffd6f use AfterLoad instead of AfterSet on Structs
  • 66ad372 fix the comments on AfterLoad
  • a9287b9 fix the comments on action AfterLoad
  • 62e79ab Fix govendor hash
  • 151a4b9 Merge branch 'master' into lunny/use_afterload

📊 Changes

35 files changed (+333 additions, -314 deletions)

View changed files

📝 models/action.go (+3 -7)
📝 models/admin.go (+3 -7)
📝 models/attachment.go (+7 -7)
📝 models/gpg_key.go (+9 -11)
📝 models/issue.go (+5 -10)
📝 models/issue_comment.go (+16 -21)
📝 models/issue_milestone.go (+12 -18)
📝 models/issue_stopwatch.go (+3 -9)
📝 models/issue_tracked_time.go (+4 -14)
📝 models/lfs.go (+3 -8)
📝 models/login_source.go (+4 -8)
📝 models/pull.go (+6 -9)
📝 models/release.go (+3 -7)
📝 models/repo.go (+12 -19)
📝 models/repo_mirror.go (+8 -12)
📝 models/repo_unit.go (+3 -6)
📝 models/ssh_key.go (+14 -22)
📝 models/status.go (+4 -8)
📝 models/token.go (+7 -12)
📝 models/twofactor.go (+5 -10)

...and 15 more files

📄 Description

The newest xorm provides new processor AfterLoad. For performance,
AfterSet will be invoked when a field be filled, but AfterLoad only is invoked after all fields be filled. And also AfterLoad allows a parameter session *xorm.Session that you can load data from the same session with the object to reduce memory usage.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/2628 **Author:** [@lunny](https://github.com/lunny) **Created:** 9/30/2017 **Status:** ✅ Merged **Merged:** 10/1/2017 **Merged by:** [@lafriks](https://github.com/lafriks) **Base:** `master` ← **Head:** `lunny/use_afterload` --- ### 📝 Commits (5) - [`3cffd6f`](https://github.com/go-gitea/gitea/commit/3cffd6fed890eb505e9af515e66135e4d002331a) use AfterLoad instead of AfterSet on Structs - [`66ad372`](https://github.com/go-gitea/gitea/commit/66ad372e871f460e2e69572bee3872b77626a701) fix the comments on AfterLoad - [`a9287b9`](https://github.com/go-gitea/gitea/commit/a9287b910646fc6901e6262041b7e274117292be) fix the comments on action AfterLoad - [`62e79ab`](https://github.com/go-gitea/gitea/commit/62e79ab879c87ddecffc77b1933b545492fc614f) Fix govendor hash - [`151a4b9`](https://github.com/go-gitea/gitea/commit/151a4b96cf5002b88cfbecce904e82180db964e1) Merge branch 'master' into lunny/use_afterload ### 📊 Changes **35 files changed** (+333 additions, -314 deletions) <details> <summary>View changed files</summary> 📝 `models/action.go` (+3 -7) 📝 `models/admin.go` (+3 -7) 📝 `models/attachment.go` (+7 -7) 📝 `models/gpg_key.go` (+9 -11) 📝 `models/issue.go` (+5 -10) 📝 `models/issue_comment.go` (+16 -21) 📝 `models/issue_milestone.go` (+12 -18) 📝 `models/issue_stopwatch.go` (+3 -9) 📝 `models/issue_tracked_time.go` (+4 -14) 📝 `models/lfs.go` (+3 -8) 📝 `models/login_source.go` (+4 -8) 📝 `models/pull.go` (+6 -9) 📝 `models/release.go` (+3 -7) 📝 `models/repo.go` (+12 -19) 📝 `models/repo_mirror.go` (+8 -12) 📝 `models/repo_unit.go` (+3 -6) 📝 `models/ssh_key.go` (+14 -22) 📝 `models/status.go` (+4 -8) 📝 `models/token.go` (+7 -12) 📝 `models/twofactor.go` (+5 -10) _...and 15 more files_ </details> ### 📄 Description The newest `xorm` provides new processor `AfterLoad`. For performance, `AfterSet` will be invoked when a field be filled, but `AfterLoad` only is invoked after all fields be filled. And also `AfterLoad` allows a parameter `session *xorm.Session` that you can load data from the same session with the object to reduce memory usage. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 12:12:21 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#16512