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:
@@ -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
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user