gitlab.com/evatix-go/core@v1.3.55/coredata/coredynamic/ZeroSet.go (about)

     1  package coredynamic
     2  
     3  import "reflect"
     4  
     5  // ZeroSet
     6  //
     7  // Sets empty bytes to the struct or the value but don't make it nil.
     8  //
     9  // It only makes all fields to nil or zero values.
    10  //
    11  // Warning :
    12  //  - Must be set as a pointer reflect value.
    13  func ZeroSet(rvPointer reflect.Value) {
    14  	elem := rvPointer.Elem()
    15  
    16  	elem.Set(reflect.Zero(elem.Type()))
    17  }