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