mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-11 09:45:43 +08:00
13 lines
246 B
Go
13 lines
246 B
Go
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
|
|
}
|