1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-03-01 00:35:28 +08:00

feat: add ToInterface

This commit is contained in:
dudaodong
2023-05-09 12:01:57 +08:00
parent e2aeb8ec07
commit c86a8a479d
3 changed files with 72 additions and 0 deletions
+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
}