You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
488 B
Go
24 lines
488 B
Go
8 months ago
|
package dao
|
||
|
|
||
|
import (
|
||
|
"chain-dci/internal/model"
|
||
|
"chain-dci/pkg/app"
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
func CreateFileInfo(tx *gorm.DB, info *model.FileInfo) error {
|
||
|
if tx == nil {
|
||
|
tx = app.ModuleClients.DciDB
|
||
|
}
|
||
|
err := tx.Model(&model.FileInfo{}).Create(&info).Error
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
func UpdateFileInfo(tx *gorm.DB, info *model.FileInfo) error {
|
||
|
if tx == nil {
|
||
|
tx = app.ModuleClients.DciDB
|
||
|
}
|
||
|
err := tx.Model(&model.FileInfo{}).Where("id =?", info.Model.ID).Updates(&info).Error
|
||
|
return err
|
||
|
}
|