验证后支持直接获取验证后结果

This commit is contained in:
白茶清欢 2025-04-28 12:41:12 +08:00
parent 901814f484
commit b3b4cc8e57

View File

@ -155,6 +155,19 @@ func (h *handle) Marshal(marshalType string) ([]byte, error) {
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 数据转换
func (h *handle) Transform(targetType string, receiver any) error {
if targetType == "" {