// Package wrapper ... // // Description : wrapper ... // // Author : go_developer@163.com<白茶清欢> // // Date : 2024-05-06 下午2:48 package wrapper import ( "fmt" "testing" ) func TestArray_Unique(t *testing.T) { fmt.Println(ArrayType[any, any]([]any{"1", 1, 1, "1", 2, 3}).Unique()) fmt.Println(ArrayType[int, any]([]int{1, 1, 2, 3}).Unique()) } func TestArray_ExtractField(t *testing.T) { testMap := []any{ map[string]any{ "age": 18, "name": "baicha", }, map[string]any{ "age": 20, "name": "qinghuan", }, map[string]any{ "foo": "bar", }, } fmt.Println(ArrayType[any, int](testMap).ExtractField("age")) fmt.Println(ArrayType[any, string](testMap).ExtractField("name")) }