Skip to content

Instantly share code, notes, and snippets.

@brabster
Created September 6, 2018 10:22
Show Gist options
  • Save brabster/dcd6e357423a29b65694b9383d39d20a to your computer and use it in GitHub Desktop.
Save brabster/dcd6e357423a29b65694b9383d39d20a to your computer and use it in GitHub Desktop.
Scala Types in Scio Pipelines - 1
object AccessLog {
case class Entry(clientIp: String, userId: String, timestamp: Instant, path: String, statusCode: Int)
def parseLine(line: String): Entry = line.split(",") match {
case Array(clientIp, userId, timestamp, path, statusCode) =>
Entry(clientIp, userId, new Instant(timestamp), path, statusCode.toInt)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment