1Panel/backend/app/service/helper.go

14 lines
246 B
Go
Raw Normal View History

2022-10-12 18:57:22 +08:00
package service
import (
"context"
"github.com/1Panel-dev/1Panel/global"
"gorm.io/gorm"
)
func getTxAndContext() (tx *gorm.DB, ctx context.Context) {
tx = global.DB.Begin()
ctx = context.WithValue(context.Background(), "db", tx)
return
}