mirror of
https://gitee.com/johng/gf
synced 2026-07-07 06:15:15 +08:00
26 lines
350 B
Go
26 lines
350 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gogf/gf/frame/g"
|
|
"github.com/gogf/gf/util/gconv"
|
|
)
|
|
|
|
type MyInt int
|
|
|
|
//func (i *MyInt) UnmarshalValue(interface{}) error {
|
|
// *i = 10
|
|
// return nil
|
|
//}
|
|
func main() {
|
|
type User struct {
|
|
Id MyInt
|
|
}
|
|
user := new(User)
|
|
err := gconv.Struct(g.Map{
|
|
"id": 1,
|
|
}, user)
|
|
fmt.Println(err)
|
|
fmt.Println(user)
|
|
}
|