add more example for gconv.Map

This commit is contained in:
John
2019-07-06 15:02:02 +08:00
parent 929a57ceb8
commit 49ef4fd266
2 changed files with 18 additions and 1 deletions

View File

@ -50,7 +50,6 @@
1. grpool增加支持阻塞添加任务接口
1. gdb.Model在链式安全的对象创建中增加sync.Pool的使用
1. 增加g.Table快捷方法以方便操作数据表但是得考虑后续模型操作设计特别是脚手架的模型管理
1. 数据库ORM增加对字段到struct属性的自动映射匹配关系文档说明
# DONE
1. gconv完善针对不同类型的判断例如尽量减少sprintf("%v", xxx)来执行string类型的转换

View File

@ -0,0 +1,18 @@
package main
import (
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/util/gconv"
)
func main() {
type User struct {
Id int `json:"uid"`
Name string `my-tag:"nick-name" json:"name"`
}
user := &User{
Id: 1,
Name: "john",
}
g.Dump(gconv.Map(user, "my-tag"))
}