Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 381 Bytes

visitor.code.md

File metadata and controls

22 lines (18 loc) · 381 Bytes

Visitor 트레이트

import java.util.Date

sealed trait Visitor {
  def id: String
  def createdAt: Date
  def age: Long = new Date().getTime() - createdAt.getTime()
}

final case class Anonymous(
  id: String,
  createdAt: Date = new Date()
) extends Visitor

final case class User(
  id: String,
  email: String,
  createdAt: Date = new Date()
) extends Visitor