github.com/songzhibin97/go-baseutils@v0.0.2-0.20240302024150-487d8ce9c082/base/btype/type.go (about) 1 package btype 2 3 // Signed is a constraint that permits any signed integer type. 4 // If future releases of Go add new predeclared signed integer types, 5 // this constraint will be modified to include them. 6 type Signed interface { 7 ~int | ~int8 | ~int16 | ~int32 | ~int64 8 } 9 10 // Unsigned is a constraint that permits any unsigned integer type. 11 // If future releases of Go add new predeclared unsigned integer types, 12 // this constraint will be modified to include them. 13 type Unsigned interface { 14 ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr 15 } 16 17 // Integer is a constraint that permits any integer type. 18 // If future releases of Go add new predeclared integer types, 19 // this constraint will be modified to include them. 20 type Integer interface { 21 Signed | Unsigned 22 } 23 24 // Float is a constraint that permits any floating-point type. 25 // If future releases of Go add new predeclared floating-point types, 26 // this constraint will be modified to include them. 27 type Float interface { 28 ~float32 | ~float64 29 } 30 31 // Complex is a constraint that permits any complex numeric type. 32 // If future releases of Go add new predeclared complex numeric types, 33 // this constraint will be modified to include them. 34 type Complex interface { 35 ~complex64 | ~complex128 36 } 37 38 // Ordered is a constraint that permits any ordered type: any type 39 // that supports the operators < <= >= >. 40 // If future releases of Go add new ordered types, 41 // this constraint will be modified to include them. 42 type Ordered interface { 43 Integer | Float | ~string 44 }