gitlab.com/evatix-go/core@v1.3.55/internal/reflectinternal/IsPrimitive.go (about)

     1  package reflectinternal
     2  
     3  import "reflect"
     4  
     5  // IsPrimitive function returns true if the kind passed to it is one of the
     6  // primitive types (boolean, int, uint, float, string)
     7  func IsPrimitive(kind reflect.Kind) bool {
     8  	switch kind {
     9  	case
    10  		reflect.Bool,
    11  		reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
    12  		reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
    13  		reflect.Uintptr,
    14  		reflect.Float32, reflect.Float64,
    15  		reflect.String:
    16  		return true
    17  	default:
    18  		return false
    19  	}
    20  }