1 Star 0 Fork 0

最爱腿腿 / goimooc_common

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
swap.go 270 Bytes
一键复制 编辑 原始数据 按行查看 历史
最爱腿腿 提交于 2024-04-28 14:18 . init
package common
import (
"encoding/json"
)
// SwapTo 通过json tag 进行结构体赋值
func SwapTo(request, category interface{}) (err error) {
dataByte, err := json.Marshal(request)
if err != nil {
return
}
err = json.Unmarshal(dataByte, category)
return
}
Go
1
https://gitee.com/fushi/goimooc_common.git
git@gitee.com:fushi/goimooc_common.git
fushi
goimooc_common
goimooc_common
8c6f2f55334a

搜索帮助