21 lines
298 B
Go
21 lines
298 B
Go
package database
|
|
|
|
import (
|
|
"context"
|
|
"github.com/loveuer/nfflow/internal/opt"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type _db struct {
|
|
client *gorm.DB
|
|
}
|
|
|
|
func (d *_db) Session(ctx context.Context) *gorm.DB {
|
|
s := d.client.Session(&gorm.Session{})
|
|
if opt.Debug > 0 || opt.DBDebug {
|
|
s = s.Debug()
|
|
}
|
|
|
|
return s
|
|
}
|