KPI绩效考核系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
629 B

package maptostruct
import (
"fmt"
"key_performance_indicators/overall/publicmethod"
"github.com/gin-gonic/gin"
)
//map 装 struct 实验
func (a *ApiMethod) MapToStructShiyan(c *gin.Context) {
mapShiyan := map[string]string{
"name": "秦东",
"age": "1",
"time": "456313",
"time1": "45631321654654",
"time2": "4.5631321654654",
"time3": "45.631321654654",
}
var shiyanVal shiyanType
err := publicmethod.MapToStruct(mapShiyan, &shiyanVal, "json")
if err != nil {
publicmethod.Result(1, err.Error(), c)
return
}
fmt.Printf("shiyanType---->%v\n", shiyanVal)
publicmethod.Result(0, shiyanVal, c)
}