davidcavazos commented on code in PR #1:
URL: https://github.com/apache/beam-starter-go/pull/1#discussion_r900499324
##########
main.go:
##########
@@ -14,31 +14,32 @@ var (
input_text = flag.String("input-text", "Default input text", "Input
text to print.")
)
-type Result = struct {
- Pipeline *beam.Pipeline
- Scope beam.Scope
- PCollection beam.PCollection
+func init() {
+ // DoFns should be registered with Beam.
+ beam.RegisterFunction(printAndEmit)
}
-func my_pipeline(input_text string) Result {
- beam.Init()
-
- pipeline, scope := beam.NewPipelineWithRoot()
+func printAndEmit(element string, emit func(string)) {
+ fmt.Println(element)
Review Comment:
Sounds good, I created an extra function to show how to do a "simple"
function and a function that takes a Context and emits values.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]