-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
51 lines (48 loc) · 820 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"log"
"strings"
)
func main() {
platforms := []Platform{
{
Name: "first",
Version: "v1",
Config: map[string]interface{}{
"name": "v1",
"register": true,
},
}, {
Name: "demosecond",
Version: "v2",
Config: map[string]interface{}{
"name": "v2",
"register": false,
},
},
}
mPlatformSlice := PlatformSlice(platforms)
newItems := mPlatformSlice.Where(func(p Platform) bool {
if strings.HasPrefix(p.Name, "demo") {
return true
}
return false
})
for _, item := range newItems {
log.Printf("%s", item)
}
myUserSets := NewMyUserSet([]MyUser{
{
Name: "dalong",
Age: 333,
},
{
Name: "dalong2",
Age: 44,
},
}...)
lists := myUserSets.ToSlice()
for _, item := range lists {
log.Printf("%s", item)
}
}