ValidateRequired 验证必需参数的通用函数
(input map[string]any, required []string)
| 15 | |
| 16 | // ValidateRequired 验证必需参数的通用函数 |
| 17 | func ValidateRequired(input map[string]any, required []string) error { |
| 18 | for _, key := range required { |
| 19 | if _, exists := input[key]; !exists { |
| 20 | return fmt.Errorf("missing required parameter: %s", key) |
| 21 | } |
| 22 | } |
| 23 | return nil |
| 24 | } |
| 25 | |
| 26 | // GetStringParam 获取字符串参数的通用函数 |
| 27 | func GetStringParam(input map[string]any, key string, defaultValue string) string { |