refactored data-types to reduce plugin sizes
This commit is contained in:
+9
-7
@@ -10,6 +10,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
"git.portale-stac.it/go-pkg/expr/types"
|
||||
"git.portale-stac.it/go-pkg/expr/types/array"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -43,8 +45,8 @@ func joinStrFunc(ctx kern.ExprContext, name string, args map[string]any) (result
|
||||
if v, exists := args[kern.ParamItem]; exists {
|
||||
argv := v.([]any)
|
||||
if len(argv) == 1 {
|
||||
if ls, ok := argv[0].(*kern.ListType); ok {
|
||||
result, err = doJoinStr(name, sep, NewListIterator(ls, nil))
|
||||
if a, ok := argv[0].(*array.ListType); ok {
|
||||
result, err = doJoinStr(name, sep, NewListIterator(a, nil))
|
||||
} else if it, ok := argv[0].(kern.Iterator); ok {
|
||||
result, err = doJoinStr(name, sep, it)
|
||||
} else if s, ok := argv[0].(string); ok {
|
||||
@@ -72,11 +74,11 @@ func subStrFunc(ctx kern.ExprContext, name string, args map[string]any) (result
|
||||
return nil, kern.ErrWrongParamType(name, kern.ParamSource, kern.TypeString, args[kern.ParamSource])
|
||||
}
|
||||
|
||||
if start, err = kern.ToGoInt(args[kern.ParamStart], name+"()"); err != nil {
|
||||
if start, err = types.ToGoInt(args[kern.ParamStart], name+"()"); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if count, err = kern.ToGoInt(args[kern.ParamCount], name+"()"); err != nil {
|
||||
if count, err = types.ToGoInt(args[kern.ParamCount], name+"()"); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -194,11 +196,11 @@ func splitStrFunc(ctx kern.ExprContext, name string, args map[string]any) (resul
|
||||
} else {
|
||||
parts = []string{}
|
||||
}
|
||||
list := make(kern.ListType, len(parts))
|
||||
a := make(array.ListType, len(parts))
|
||||
for i, part := range parts {
|
||||
list[i] = part
|
||||
a[i] = part
|
||||
}
|
||||
result = &list
|
||||
result = &a
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user