17 lines
237 B
Go
17 lines
237 B
Go
|
package internal
|
||
|
|
||
|
import "reflect"
|
||
|
|
||
|
func ParseExcelValueType[T interface{}](s string) T {
|
||
|
var i T
|
||
|
|
||
|
t := reflect.TypeOf(i)
|
||
|
|
||
|
switch t.Kind() {
|
||
|
case reflect.String:
|
||
|
return reflect.ValueOf(s).Convert(t).Interface().(T)
|
||
|
}
|
||
|
|
||
|
return i
|
||
|
}
|