github.com/OrigamiWang/msd/micro@v0.0.0-20240229032328-b62246268db9/util/transfer/transfer.go (about)

     1  package transfer
     2  
     3  import (
     4  	"github.com/OrigamiWang/msd/micro/model"
     5  	logutil "github.com/OrigamiWang/msd/micro/util/log"
     6  	"github.com/mitchellh/mapstructure"
     7  )
     8  
     9  func FacadeRespToMap(m map[string]interface{}, resp interface{}) (map[string]interface{}, error) {
    10  	var modelResp *model.Response
    11  	err := mapstructure.Decode(m, &modelResp)
    12  	if err != nil {
    13  		logutil.Error("unmarshal register config failed, err: %v", err)
    14  		panic(err.Error())
    15  	}
    16  	result := modelResp.Data.(map[string]interface{})
    17  	return result, nil
    18  }