mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-12-24 13:18:09 +08:00
23 lines
264 B
Go
23 lines
264 B
Go
package slicex
|
|
|
|
import "fmt"
|
|
|
|
func ExampleColumn() {
|
|
type Person struct {
|
|
Name string
|
|
Age int
|
|
}
|
|
people := []Person{
|
|
{"Alice", 18},
|
|
{"Bob", 20},
|
|
{"Charlie", 22},
|
|
}
|
|
|
|
res := Column(people, "Age")
|
|
|
|
fmt.Printf("%+v", res)
|
|
|
|
// Output:
|
|
// [18 20 22]
|
|
}
|