|
@@ -354,20 +354,20 @@ func ToFloat64(data any) (float64, error) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func Zero[T any]() any {
|
|
|
+func Zero[T any]() T {
|
|
|
var zeroAny T
|
|
|
|
|
|
zeroValue := reflect.New(reflect.TypeOf(zeroAny)).Elem()
|
|
|
if zeroValue.Kind() != reflect.Pointer {
|
|
|
zero(&zeroValue)
|
|
|
- return zeroValue.Interface()
|
|
|
+ return zeroValue.Interface().(T)
|
|
|
}
|
|
|
|
|
|
zeroValue.Set(reflect.New(zeroValue.Type().Elem()))
|
|
|
elemValue := PointerValueElem(zeroValue)
|
|
|
zero(&elemValue)
|
|
|
|
|
|
- return zeroValue.Interface()
|
|
|
+ return zeroValue.Interface().(T)
|
|
|
}
|
|
|
|
|
|
func ZeroValue(v reflect.Value) reflect.Value {
|