var.go 254 B

12345678910111213
  1. package utils
  2. type PointValue interface {
  3. int | bool | float64 | uint | uint32 | uint64 | string
  4. }
  5. // SetPointValue 给Struct的指针类型成员赋值
  6. func SetPointValue[T PointValue](value T) (field *T) {
  7. field = new(T)
  8. *field = value
  9. return
  10. }