The previous pipeline model required a lot of setup and abstracted away the processing of records. By passing a HandlerFunc to the consumer we keep the business logic of processing of records closer to the use of the consumer. * Add refactoring note and SHA to README
16 lines
309 B
Go
16 lines
309 B
Go
package connector
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func S3Key(prefix, firstSeq, lastSeq string) string {
|
|
date := time.Now().UTC().Format("2006/01/02")
|
|
|
|
if prefix == "" {
|
|
return fmt.Sprintf("%v/%v-%v", date, firstSeq, lastSeq)
|
|
} else {
|
|
return fmt.Sprintf("%v/%v/%v-%v", prefix, date, firstSeq, lastSeq)
|
|
}
|
|
}
|