accept lunny's suggestion
This commit is contained in:
parent
06f24231f2
commit
57fd669942
13
session.go
13
session.go
|
@ -100,17 +100,8 @@ func newSessionID() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func newSession(engine *Engine) *Session {
|
func newSession(engine *Engine) *Session {
|
||||||
var ctx context.Context
|
|
||||||
var sessionID string
|
|
||||||
if engine.logSessionID {
|
|
||||||
sessionID = newSessionID()
|
|
||||||
ctx = context.WithValue(engine.defaultContext, log.SessionIDKey, sessionID)
|
|
||||||
} else {
|
|
||||||
ctx = engine.defaultContext
|
|
||||||
}
|
|
||||||
|
|
||||||
session := &Session{
|
session := &Session{
|
||||||
ctx: ctx,
|
ctx: engine.defaultContext,
|
||||||
engine: engine,
|
engine: engine,
|
||||||
tx: nil,
|
tx: nil,
|
||||||
statement: statements.NewStatement(
|
statement: statements.NewStatement(
|
||||||
|
@ -139,7 +130,7 @@ func newSession(engine *Engine) *Session {
|
||||||
sessionType: engineSession,
|
sessionType: engineSession,
|
||||||
}
|
}
|
||||||
if engine.logSessionID {
|
if engine.logSessionID {
|
||||||
session.ctx = context.WithValue(session.ctx, sessionID, session)
|
session.ctx = context.WithValue(session.ctx, log.SessionIDKey, session)
|
||||||
}
|
}
|
||||||
return session
|
return session
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue