This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "github.com/trustmaster/goflow" | |
| ) | |
| // Greeter sends greetings | |
| type Greeter struct { | |
| Name <-chan string // input port |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func main() { | |
| // Build mesh | |
| numbersCruncher := getMesh() | |
| // Init with data | |
| numbersCruncher.ComponentByName("first-stage").InputByName("num").PutSignals( | |
| signal.New(1), | |
| signal.New(2), | |
| signal.New(3), | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func(this *component.Component) error { | |
| num := this.InputByName("num").Signals().FirstPayloadOrDefault(0) // Read inputs | |
| this.OutputByName("res").PutSignals(signal.New(num.(int) * 3)) // Provide outputs | |
| return nil // Report possible errors | |
| } |
NewerOlder