engine: resources: Consider passing in funcs if possible
Let this sit in the test resource for now.
This commit is contained in:
@@ -86,6 +86,9 @@ type TestRes struct {
|
|||||||
|
|
||||||
AnotherStr string `lang:"anotherstr" yaml:"anotherstr"`
|
AnotherStr string `lang:"anotherstr" yaml:"anotherstr"`
|
||||||
|
|
||||||
|
// Func1 passes the value 42 to the input and returns a string.
|
||||||
|
Func1 func(int) string `lang:"func1" yaml:"func1"`
|
||||||
|
|
||||||
ValidateBool bool `lang:"validatebool" yaml:"validate_bool"` // set to true to cause a validate error
|
ValidateBool bool `lang:"validatebool" yaml:"validate_bool"` // set to true to cause a validate error
|
||||||
ValidateError string `lang:"validateerror" yaml:"validate_error"` // set to cause a validate error
|
ValidateError string `lang:"validateerror" yaml:"validate_error"` // set to cause a validate error
|
||||||
AlwaysGroup bool `lang:"alwaysgroup" yaml:"always_group"` // set to true to cause auto grouping
|
AlwaysGroup bool `lang:"alwaysgroup" yaml:"always_group"` // set to true to cause auto grouping
|
||||||
@@ -187,6 +190,10 @@ func (obj *TestRes) CheckApply(ctx context.Context, apply bool) (bool, error) {
|
|||||||
|
|
||||||
obj.init.Logf("%s: AnotherStr: %v", obj, obj.AnotherStr)
|
obj.init.Logf("%s: AnotherStr: %v", obj, obj.AnotherStr)
|
||||||
|
|
||||||
|
if obj.Func1 != nil {
|
||||||
|
obj.init.Logf("%s: Func1: %v", obj, obj.Func1(42))
|
||||||
|
}
|
||||||
|
|
||||||
// send
|
// send
|
||||||
hello := obj.SendValue
|
hello := obj.SendValue
|
||||||
if err := obj.init.Send(&TestSends{
|
if err := obj.init.Send(&TestSends{
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ func Into(v Value, rv reflect.Value) error {
|
|||||||
return Into(v.V, rv)
|
return Into(v.V, rv)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("cannot Into() %+v of type %s into %s", v, v.Type(), typ)
|
return fmt.Errorf("cannot Into() %+v of type (%T) %s into %s", v, v, v.Type(), typ)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user