-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34cbc2e
commit b676667
Showing
2 changed files
with
22 additions
and
21 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package datas | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/flipped-aurora/gva/data/model" | ||
"gorm.io/gorm" | ||
) | ||
|
||
var Files = []model.ExaFileUploadAndDownload{ | ||
{gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "10.png", "http://qmplusimg.henrongyi.top/gvalogo.png", "png", "158787308910.png"}, | ||
{gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "logo.png", "http://qmplusimg.henrongyi.top/1576554439myAvatar.png", "png", "1587973709logo.png"}, | ||
} | ||
|
||
func InitExaFileUploadAndDownload(db *gorm.DB) (err error) { | ||
return db.Transaction(func(tx *gorm.DB) error { | ||
if tx.Create(&Files).Error != nil { // 遇到错误时回滚事务 | ||
return err | ||
} | ||
return nil | ||
}) | ||
} |