Skip to content

Commit 04d1eb5

Browse files
authored
Add document for support array result (#173)
1 parent 6696cee commit 04d1eb5

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

docs/ACTION.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,33 @@ func Main(obj map[string]interface{}) map[string]interface{} {
6363
}
6464
```
6565

66+
For the return result, not only support `map[string]interface{}` but also support `[]interface{}`
67+
68+
So a very simple `hello array` function would be:
69+
70+
```go
71+
package main
72+
73+
// Main is the function implementing the action
74+
func Main(event map[string]interface{}) []interface{} {
75+
result := []interface{}{"a", "b"}
76+
return result
77+
}
78+
```
79+
80+
And support array result for sequence action as well, the first action's array result can be used as next action's input parameter.
81+
82+
So the function can be:
83+
84+
```go
85+
package main
86+
87+
// Main is the function implementing the action
88+
func Main(obj []interface{}) []interface{} {
89+
return obj
90+
}
91+
```
92+
6693
You can also have multiple source files in an action, packages and vendor folders. Check the [deployment](DEPLOY.md) document for more details how to package and deploy actions.
6794

6895
<a name="generic"/>

0 commit comments

Comments
 (0)