package utils

import "reflect"

// isBasicType 判断传入的 obj 是否为基本类型
func isBasicType(obj interface{}) bool {
	kind := reflect.TypeOf(obj).Kind()

	// 列出基本类型
	basicKinds := []reflect.Kind{
		reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
		reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
		reflect.Float32, reflect.Float64,
		reflect.Complex64, reflect.Complex128,
		reflect.Bool,
		reflect.String,
		reflect.Uintptr,
		reflect.UnsafePointer,
	}

	for _, k := range basicKinds {
		if kind == k {
			return true
		}
	}

	return false
}
