mirror of
https://gitee.com/johng/gf
synced 2026-06-23 08:29:25 +08:00
26 lines
308 B
Go
26 lines
308 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/gogf/gf/util/gconv"
|
|
)
|
|
|
|
// struct转slice
|
|
func main() {
|
|
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",
|
|
}))
|
|
}
|