add NewSessionWithContext
This commit is contained in:
parent
efa3d0f877
commit
937fb624eb
5
gorm.go
5
gorm.go
@ -1,6 +1,7 @@
|
|||||||
package gorm
|
package gorm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -46,6 +47,10 @@ func NewSession(db *gorm.DB) *gorm.DB {
|
|||||||
return db.Session(&gorm.Session{})
|
return db.Session(&gorm.Session{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewSessionWithContext(db *gorm.DB, ctx context.Context) *gorm.DB {
|
||||||
|
return db.Session(&gorm.Session{Context: ctx})
|
||||||
|
}
|
||||||
|
|
||||||
func DefaultLogger() gormlogger.Interface {
|
func DefaultLogger() gormlogger.Interface {
|
||||||
return defaultLogger
|
return defaultLogger
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user