forked from project-flogo/contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompound.go
48 lines (37 loc) · 861 Bytes
/
compound.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package coerce
import (
"github.com/project-flogo/core/data/coerce"
"github.com/project-flogo/core/data/expression/function"
)
func init() {
_ = function.Register(&fnToParams{})
_ = function.Register(&fnToObject{})
_ = function.Register(&fnToArray{})
}
type fnToParams struct {
*baseFn
}
func (*fnToParams) Name() string {
return "toParams"
}
func (*fnToParams) Eval(params ...interface{}) (interface{}, error) {
return coerce.ToParams(params[0])
}
type fnToObject struct {
*baseFn
}
func (*fnToObject) Name() string {
return "toObject"
}
func (*fnToObject) Eval(params ...interface{}) (interface{}, error) {
return coerce.ToObject(params[0])
}
type fnToArray struct {
*baseFn
}
func (*fnToArray) Name() string {
return "toArray"
}
func (*fnToArray) Eval(params ...interface{}) (interface{}, error) {
return coerce.ToArray(params[0])
}