mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-29 14:31:15 +08:00
14 lines
254 B
Go
14 lines
254 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"github.com/1Panel-dev/1Panel/backend/global"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func getTxAndContext() (tx *gorm.DB, ctx context.Context) {
|
|
tx = global.DB.Begin()
|
|
ctx = context.WithValue(context.Background(), "db", tx)
|
|
return
|
|
}
|