代码优化
This commit is contained in:
parent
bc99c08d55
commit
352fd61f92
@ -159,6 +159,23 @@ func (e *execute) formatAndValidateInputParam(inputParam *define.Api2SqlParam) e
|
||||
return errors.New(inputParam.DatabaseFlag + " : table field list is empty, please enable `CacheDataTableStructureConfig` or `SetTableColumnConfig`")
|
||||
}
|
||||
// 操作字段列表为空
|
||||
if err = e.validateColumn(inputParam); nil != err {
|
||||
return err
|
||||
}
|
||||
// 验证 force no limit
|
||||
if inputParam.ForceNoLimit {
|
||||
inputParam.Limit = 0
|
||||
inputParam.WithCount = false
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// validateColumn 验证表字段相关
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:48 2024/8/22
|
||||
func (e *execute) validateColumn(inputParam *define.Api2SqlParam) error {
|
||||
if len(inputParam.ColumnList) == 0 && wrapper.ArrayType[string]([]string{
|
||||
consts.SqlTypeList, consts.SqlTypeDetail,
|
||||
}).Has(inputParam.SqlType) >= 0 {
|
||||
@ -181,10 +198,5 @@ func (e *execute) formatAndValidateInputParam(inputParam *define.Api2SqlParam) e
|
||||
return errors.New(item.Column + " : input column in `ValueList` is not found in table column list")
|
||||
}
|
||||
}
|
||||
// 验证 force no limit
|
||||
if inputParam.ForceNoLimit {
|
||||
inputParam.Limit = 0
|
||||
inputParam.WithCount = false
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user