mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Rename the Length methods Len to follow GO standart
This commit is contained in:
21
pkg/obieval/language.go
Normal file
21
pkg/obieval/language.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user