Documentation
¶
Overview ¶
Package types 提供反射类型辅助函数。
Package types 封装了零值创建、指针包装、类型名和完整限定名等常见反射操作,用于 原型系统、断言注入和代码生成支持逻辑。
当框架需要在运行期根据实例或 reflect.Type 推导名称、创建零值或写出全限定类型名时, 通常会使用该包。
Index ¶
- func Bool2Int[T Integer](b bool) T
- func Bytes2String(b []byte) string
- func FullName(i any) string
- func FullNameRT(t reflect.Type) string
- func FullNameT[T any]() string
- func Int2Bool[T Integer](v T) bool
- func Name(i any) string
- func NameRT(t reflect.Type) string
- func NameT[T any]() string
- func New[T any]() *T
- func Panic2Err(panicInfo any) error
- func Pointer[T any](src T) *T
- func String2Bytes(s string) []byte
- func WriteFullName(sb *strings.Builder, i any)
- func WriteFullNameRT(sb *strings.Builder, t reflect.Type)
- func WriteFullNameT[T any](sb *strings.Builder)
- func Zero[T any]() T
- type Integer
- type Signed
- type Unsigned
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteFullName ¶ added in v0.3.65
WriteFullName 将值或 reflect.Type 的完整名称写入 sb。
func WriteFullNameRT ¶
WriteFullNameRT 将 t 的完整名称写入 sb。
func WriteFullNameT ¶
WriteFullNameT 将 T 的完整名称写入 sb。
Types ¶
Click to show internal directories.
Click to hide internal directories.