feat: docs api design

This commit is contained in:
neo-f
2023-03-22 22:45:17 +08:00
commit 084d0de8bc
52 changed files with 3420 additions and 0 deletions

14
pkg/utils/ptr.go Normal file
View File

@@ -0,0 +1,14 @@
package utils
import "reflect"
func Ptr[T any](v T) *T {
return &v
}
func Unptr[T any](v *T) T {
if v == nil {
return reflect.Zero(reflect.TypeOf(v).Elem()).Interface().(T)
}
return *v
}