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

Use AfterLoad instead of AfterSet on Structs #2628

Merged
merged 5 commits into from Oct 1, 2017

Conversation

lunny
Copy link
Member

@lunny lunny commented Sep 30, 2017

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.

@lunny lunny added the type/enhancement An improvement of existing functionality label Sep 30, 2017
@lunny lunny added this to the 1.3.0 milestone Sep 30, 2017
Copy link
Member

@ethantkoenig ethantkoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one suggestion

case "updated_unix":
source.Updated = time.Unix(source.UpdatedUnix, 0).Local()
}
// AfterLoad is invoked from XORM after setting the value of a field of this object.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment seems stale, please update it (also in other places)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@lunny
Copy link
Member Author

lunny commented Sep 30, 2017

And @ethantkoenig, could you help me update the latest xorm since my govendor has some issue.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 30, 2017
@ethantkoenig
Copy link
Member

@lunny I don't have write permissions, so I don't think I can merge into your branch

@ethantkoenig
Copy link
Member

I could create a separate PR that just updates xorm if that'd be helpful

@lafriks
Copy link
Member

lafriks commented Oct 1, 2017

@lunny fixed govendor hash

@codecov-io
Copy link

codecov-io commented Oct 1, 2017

Codecov Report

Merging #2628 into master will decrease coverage by 0.18%.
The diff coverage is 54.7%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2628      +/-   ##
==========================================
- Coverage   27.29%   27.11%   -0.19%     
==========================================
  Files          86       86              
  Lines       17144    17064      -80     
==========================================
- Hits         4680     4627      -53     
+ Misses      11786    11759      -27     
  Partials      678      678
Impacted Files Coverage Δ
models/repo_unit.go 8% <0%> (+0.3%) ⬆️
models/ssh_key.go 10.6% <0%> (+0.11%) ⬆️
models/gpg_key.go 30.28% <0%> (+0.09%) ⬆️
models/twofactor.go 0% <0%> (ø) ⬆️
models/repo_mirror.go 0.63% <0%> (+0.01%) ⬆️
models/login_source.go 0% <0%> (ø) ⬆️
models/lfs.go 0% <0%> (ø) ⬆️
models/release.go 0% <0%> (ø) ⬆️
models/status.go 3.4% <100%> (-1.62%) ⬇️
models/user.go 18.06% <100%> (-0.36%) ⬇️
... 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 1ad902d...151a4b9. Read the comment docs.

@lafriks
Copy link
Member

lafriks commented Oct 1, 2017

LGTM

@tboerger tboerger 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 1, 2017
@ethantkoenig
Copy link
Member

LGTM

@tboerger tboerger 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 1, 2017
@lafriks lafriks merged commit a8717e5 into go-gitea:master Oct 1, 2017
@lunny lunny deleted the lunny/use_afterload branch October 2, 2017 13:53
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
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/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants