milvus/internal/util/funcutil/aggregation.go
Jiquan Long bdd6171231
Make creating collection/partition follow tt mechanism (#19628)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
2022-10-09 12:32:57 +08:00

57 lines
829 B
Go

package funcutil
/*
type aggFunc[T constraints.Ordered] func(t1, t2 T) T
func agg[T constraints.Ordered](op aggFunc[T], s ...T) T {
l := len(s)
if l <= 0 {
var zero T
return zero
}
m := s[0]
for i := 1; i < l; i++ {
m = op(s[i], m)
}
return m
}
func getMin[T constraints.Ordered](t1, t2 T) T {
if t1 < t2 {
return t1
}
return t2
}
func getMax[T constraints.Ordered](t1, t2 T) T {
if t1 < t2 {
return t2
}
return t1
}
func getSum[T constraints.Ordered](t1, t2 T) T {
return t1 + t2
}
func Min[T constraints.Ordered](s ...T) T {
return agg[T](getMin[T], s...)
}
func Max[T constraints.Ordered](s ...T) T {
return agg[T](getMax[T], s...)
}
func Sum[T constraints.Ordered](s ...T) T {
return agg[T](getSum[T], s...)
}
*/
func Min(t1, t2 uint64) uint64 {
if t1 < t2 {
return t1
}
return t2
}