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
Conversation
There was a problem hiding this 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
models/login_source.go
Outdated
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. |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
And @ethantkoenig, could you help me update the latest xorm since my |
@lunny I don't have write permissions, so I don't think I can merge into your branch |
I could create a separate PR that just updates xorm if that'd be helpful |
@lunny fixed govendor hash |
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
LGTM |
LGTM |
The newest
xorm
provides new processorAfterLoad
. For performance,AfterSet
will be invoked when a field be filled, butAfterLoad
only is invoked after all fields be filled. And alsoAfterLoad
allows a parametersession *xorm.Session
that you can load data from the same session with the object to reduce memory usage.