Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
laodaming
2023-09-21 18:21:37 +08:00
7 changed files with 106 additions and 18 deletions

View File

@@ -57,7 +57,7 @@ func hasInvalidPatterns(key string) bool {
return false
}
var checkModuleRe = regexp.MustCompile("[^\\.a-zA-Z_-]")
var checkModuleRe = regexp.MustCompile("[^\\.a-zA-Z_\\-0-9]")
// CheckModuleQuery 检查模块的json查询的格式
func CheckModuleQuery(moduleQuery string) bool {

View File

@@ -52,6 +52,7 @@ func MetadataModulePATCH(tx *gorm.DB, module string, tableStructPointer any, upd
if stype.Kind() == reflect.Pointer {
stype = stype.Elem()
}
tname := tx.NamingStrategy.TableName(stype.Name())
updatesql := `UPDATE %s
SET metadata = CASE
@@ -80,7 +81,7 @@ func MetadataModulePATCH(tx *gorm.DB, module string, tableStructPointer any, upd
args = append(args, metadata, metadata)
args = append(args, values...)
updatesql = fmt.Sprintf(updatesql, tx.NamingStrategy.TableName(stype.Name()), module, WhereKeysCond)
updatesql = fmt.Sprintf(updatesql, tname, module, WhereKeysCond)
// logx.Error(updatesql)
err = tx.Exec(updatesql, args...).Error
if err != nil {