go_import_excel_pg/internal/parse_excel.go

17 lines
237 B
Go
Raw Permalink Normal View History

2024-02-22 10:43:39 +07:00
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
}