mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
22 lines
543 B
Go
22 lines
543 B
Go
|
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)
|
||
|
}
|