feat: add ToInterface

This commit is contained in:
dudaodong committed 2023-05-09 12:01:57 +08:00
1 parent e2aeb8ec07
commit c86a8a479d
3 files changed
+72

No files matched your search

+15
View File
@@ -2,6 +2,7 @@ package convertor
import (
"fmt"
"reflect"
"strconv"
)
@@ -349,3 +350,17 @@ func ExampleCopyProperties() {
// 127.0.0.1
// 3
}
func ExampleToInterface() {
val := reflect.ValueOf("abc")
iVal, ok := ToInterface(val)
fmt.Printf("%T\n", iVal)
fmt.Printf("%v\n", iVal)
fmt.Println(ok)
// Output:
// string
// abc
// true
}