mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
18 lines
291 B
Go
18 lines
291 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/global"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type dbStr string
|
|
|
|
func getTxAndContext() (tx *gorm.DB, ctx context.Context) {
|
|
db := dbStr("db")
|
|
tx = global.DB.Begin()
|
|
ctx = context.WithValue(context.Background(), db, tx)
|
|
return
|
|
}
|