You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by dg...@apache.org on 2022/08/07 17:34:38 UTC

[openwhisk-runtime-go] branch master updated: Add document for support array result (#173)

This is an automated email from the ASF dual-hosted git repository.

dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 04d1eb5  Add document for support array result (#173)
04d1eb5 is described below

commit 04d1eb50fb3346f7336ec3a6c45dde901f20eb9d
Author: ningyougang <ni...@navercorp.com>
AuthorDate: Mon Aug 8 01:34:33 2022 +0800

    Add document for support array result (#173)
---
 docs/ACTION.md | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/docs/ACTION.md b/docs/ACTION.md
index e18075d..0701473 100644
--- a/docs/ACTION.md
+++ b/docs/ACTION.md
@@ -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"/>