Skip to content

Commit

Permalink
Add document for support array result (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
ningyougang authored Aug 7, 2022
1 parent 6696cee commit 04d1eb5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/ACTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,33 @@ func Main(obj map[string]interface{}) map[string]interface{} {
}
```

For the return result, not only support `map[string]interface{}` but also support `[]interface{}`

So a very simple `hello array` function would be:

```go
package main

// Main is the function implementing the action
func Main(event map[string]interface{}) []interface{} {
result := []interface{}{"a", "b"}
return result
}
```

And support array result for sequence action as well, the first action's array result can be used as next action's input parameter.

So the function can be:

```go
package main

// Main is the function implementing the action
func Main(obj []interface{}) []interface{} {
return obj
}
```

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.

<a name="generic"/>
Expand Down

0 comments on commit 04d1eb5

Please sign in to comment.