mirror of
https://gitee.com/johng/gf.git
synced 2024-12-05 05:37:55 +08:00
24 lines
306 B
Go
24 lines
306 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gogf/gf/g"
|
|
"github.com/gogf/gf/g/util/gconv"
|
|
)
|
|
|
|
func main() {
|
|
type User struct {
|
|
Uid int
|
|
Name string
|
|
}
|
|
user := (*User)(nil)
|
|
params := g.Map{
|
|
"uid": 1,
|
|
"name": "john",
|
|
}
|
|
err := gconv.Struct(params, &user)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
g.Dump(user)
|
|
}
|