fix ctx override bug (#2053)
详情请参考工单:https://gitea.com/xorm/xorm/issues/2052 Co-authored-by: undefined_ss <sununiq@163.com> Reviewed-on: https://gitea.com/xorm/xorm/pulls/2053 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: undefined_ss <undefined_ss@noreply.gitea.io> Co-committed-by: undefined_ss <undefined_ss@noreply.gitea.io>
This commit is contained in:
parent
fd26f415ca
commit
0de285680b
|
@ -732,6 +732,12 @@ func (session *Session) incrVersionFieldValue(fieldValue *reflect.Value) {
|
||||||
|
|
||||||
// Context sets the context on this session
|
// Context sets the context on this session
|
||||||
func (session *Session) Context(ctx context.Context) *Session {
|
func (session *Session) Context(ctx context.Context) *Session {
|
||||||
|
if session.ctx != nil {
|
||||||
|
ctx = context.WithValue(ctx, log.SessionIDKey, session.ctx.Value(log.SessionIDKey))
|
||||||
|
ctx = context.WithValue(ctx, log.SessionKey, session.ctx.Value(log.SessionKey))
|
||||||
|
ctx = context.WithValue(ctx, log.SessionShowSQLKey, session.ctx.Value(log.SessionShowSQLKey))
|
||||||
|
}
|
||||||
|
|
||||||
session.ctx = ctx
|
session.ctx = ctx
|
||||||
return session
|
return session
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue