Migrate the gva project to the cmd folder, delete other redundant database configurations, optimize the initialization method of viper, zap, and gorm

This commit is contained in:
SliverHorn
2020-10-22 16:28:51 +08:00
parent 45f2bd4a15
commit dd65a4a716
28 changed files with 1010 additions and 698 deletions
+27
View File
@@ -0,0 +1,27 @@
package datas
import (
"gorm.io/gorm"
)
type SysDataAuthorityId struct {
SysAuthorityAuthorityId string
DataAuthorityIdAuthorityId string
}
var DataAuthorityId = []SysDataAuthorityId{
{"888", "888"},
{"888", "8881"},
{"888", "9528"},
{"9528", "8881"},
{"9528", "9528"},
}
func InitSysDataAuthorityId(db *gorm.DB) (err error) {
return db.Transaction(func(tx *gorm.DB) error {
if tx.Create(&DataAuthorityId).Error != nil { // 遇到错误时回滚事务
return err
}
return nil
})
}