1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

14 lines
254 B
Go
Raw Normal View History

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