Created
May 29, 2020 14:43
-
-
Save RicardoLinck/7c84c5d61837ef2e0426e31582e225a6 to your computer and use it in GitHub Desktop.
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 ( | |
"log" | |
"time" | |
"github.com/google/uuid" | |
) | |
type inputData struct { | |
id string | |
timestamp int64 | |
} | |
func prepareData(ic <-chan uuid.UUID) <-chan inputData { | |
oc := make(chan inputData) | |
go func() { | |
for id := range ic { | |
input := inputData{id: id.String(), timestamp: time.Now().UnixNano()} | |
log.Printf("Data ready for processing: %+v", input) | |
oc <- input | |
} | |
close(oc) | |
}() | |
return oc | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment