Rename the Length methods Len to follow GO standart

This commit is contained in:
2022-11-17 11:09:58 +01:00
parent eb32089305
commit 29563aa94e
30 changed files with 134 additions and 130 deletions

21
pkg/obieval/language.go Normal file
View File

@ -0,0 +1,21 @@
package obieval
import (
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
"github.com/PaesslerAG/gval"
)
var OBILang = gval.NewLanguage(
gval.Full(),
gval.Function("len", func(args ...interface{}) (interface{}, error) {
length := goutils.Len(args[0])
return (float64)(length), nil
}),
gval.Function("ismap", func(args ...interface{}) (interface{}, error) {
ismap := goutils.IsAMap(args[0])
return ismap, nil
}))
func Expression(expression string) (gval.Evaluable, error) {
return OBILang.NewEvaluable(expression)
}