aboutsummaryrefslogtreecommitdiff
path: root/utils/constraints.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/constraints.go')
-rw-r--r--utils/constraints.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/constraints.go b/utils/constraints.go
new file mode 100644
index 0000000..c63ea63
--- /dev/null
+++ b/utils/constraints.go
@@ -0,0 +1,11 @@
+package utils
+
+// Scalar соответствует скалярам над которыми определены операции сравнения
+type Scalar interface {
+ ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64 | ~string
+}
+
+// Sortable соответствует типам над которыми определена операция Less
+type Sortable[T any] interface {
+ Less(T) bool
+}