验证后支持直接获取验证后结果
This commit is contained in:
		
							
								
								
									
										13
									
								
								validate.go
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								validate.go
									
									
									
									
									
								
							@ -155,6 +155,19 @@ func (h *handle) Marshal(marshalType string) ([]byte, error) {
 | 
				
			|||||||
	return serialize.Wrapper.Marshal(marshalType, h.Result())
 | 
						return serialize.Wrapper.Marshal(marshalType, h.Result())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Map 直接获取map结果
 | 
				
			||||||
 | 
					func (h *handle) Map(marshalType string) (map[string]any, error) {
 | 
				
			||||||
 | 
						if marshalType == "" {
 | 
				
			||||||
 | 
							marshalType = "json" // 默认按照json序列化
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var res map[string]any
 | 
				
			||||||
 | 
						err := h.Transform(marshalType, &res)
 | 
				
			||||||
 | 
						if nil != err {
 | 
				
			||||||
 | 
							return res, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return res, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Transform 数据转换
 | 
					// Transform 数据转换
 | 
				
			||||||
func (h *handle) Transform(targetType string, receiver any) error {
 | 
					func (h *handle) Transform(targetType string, receiver any) error {
 | 
				
			||||||
	if targetType == "" {
 | 
						if targetType == "" {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user