add NewSessionWithContext

This commit is contained in:
bryan 2026-01-31 08:24:11 +08:00
parent efa3d0f877
commit 1da547ae37

View File

@ -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
}