diff --git a/gorm.go b/gorm.go index d1d3915..a7cb181 100644 --- a/gorm.go +++ b/gorm.go @@ -1,6 +1,7 @@ package gorm import ( + "context" "crypto/md5" "encoding/hex" "encoding/json" @@ -46,6 +47,10 @@ func NewSession(db *gorm.DB) *gorm.DB { 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 { return defaultLogger }