mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-21 01:09:17 +08:00
22 lines
528 B
Go
22 lines
528 B
Go
|
package repo
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/1Panel-dev/1Panel/app/model"
|
||
|
"github.com/1Panel-dev/1Panel/global"
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
type AppContainerRepo struct {
|
||
|
}
|
||
|
|
||
|
func (a AppContainerRepo) Create(container *model.AppContainer) error {
|
||
|
db := global.DB.Model(&model.AppContainer{})
|
||
|
return db.Create(&container).Error
|
||
|
}
|
||
|
|
||
|
func (a AppContainerRepo) BatchCreate(ctx context.Context, containers []*model.AppContainer) error {
|
||
|
db := ctx.Value("db").(*gorm.DB)
|
||
|
return db.Model(&model.AppContainer{}).Create(&containers).Error
|
||
|
}
|