Skip to content
Documentation
CLI
yomo init <function>

yomo init

Generate a StreamFunction project.

Usage

yomo init [flags] project-name

Flags

  • -r or --rx: Generate a StreamFunction project in Rx.
  • -n or --name: Set the name of the StreamFunction project.

Example

 yomo init accumulator-func
 
  Initializing the Stream Function...
  Congratulations! You have initialized the stream function successfully.
 
 cd accumulator-func
 
 exa -Tla 
 
drwxr-xr-x@   - CC 16 Apr 20:39 .
.rw-r--r--@  31 CC 16 Apr 20:39 ├── .env
.rw-r--r--@ 359 CC 16 Apr 20:39 └── app.go

cat app.go will get:

package main
 
import (
	"fmt"
	"strings"
 
	"github.com/yomorun/yomo/core/frame"
)
 
// Handler will handle the raw bytes of data
func Handler(data []byte) (frame.Tag, []byte) {
	fmt.Printf("sfn received %d bytes\n", len(data))
	output := strings.ToUpper(string(data))
	return frame.Tag(0x34), []byte(output)
}
 
// DataTags indicate the tags of data to observe
func DataTags() []frame.Tag {
	return []frame.Tag{0x33}
}

Now, just execute yomo dev, it works!