Files
gf/.example/util/gconv/gconv_slice.go

26 lines
308 B
Go
Raw Normal View History

package main
import (
2019-04-03 00:03:46 +08:00
"fmt"
2019-07-29 21:01:19 +08:00
"github.com/gogf/gf/util/gconv"
)
// struct转slice
func main() {
2019-04-03 00:03:46 +08:00
type User struct {
Uid int
Name string
}
// 对象
fmt.Println(gconv.Interfaces(User{
Uid: 1,
Name: "john",
}))
// 指针
fmt.Println(gconv.Interfaces(&User{
Uid: 1,
Name: "john",
}))
}