Patch the Min and Max values of the expression language

This commit is contained in:
Eric Coissac
2025-06-19 16:43:26 +02:00
parent 9965370d85
commit add9d89ccc
3 changed files with 33 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
"strings"
"sync"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
"github.com/goccy/go-json"
log "github.com/sirupsen/logrus"
@ -109,6 +110,24 @@ func (sov *StatsOnValues) Map() map[string]int {
return sov.counts
}
func (sov *StatsOnValues) Max() int {
data, err := obiutils.Max(sov.counts)
if err != nil {
return -1
}
return data.(int)
}
func (sov *StatsOnValues) Min() int {
data, err := obiutils.Min(sov.counts)
if err != nil {
return -1
}
return data.(int)
}
func (sov *StatsOnValues) Set(key string, value int) {
if sov == nil {
return