Created
September 27, 2017 06:18
-
-
Save NthPortal/37f91d725ba96d1b09e0fcc076f09566 to your computer and use it in GitHub Desktop.
This file contains 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
case class User(id: User.Id, firstName: User.FirstName, lastName: User.LastName, email: User.Email) | |
object User { | |
opaque type Id = Long | |
object Id { | |
def apply(value: Long): Id = value | |
implicit class Ops(val self: Id) extends AnyVal { | |
def value: Long = self | |
} | |
} | |
opaque type FirstName = String | |
object FirstName { | |
def apply(value: String): FirstName = value | |
implicit class Ops(val self: FirstName) extends AnyVal { | |
def value: String = self | |
} | |
} | |
opaque type LastName = String | |
object LastName { | |
def apply(value: String): LastName = value | |
implicit class Ops(val self: LastName) extends AnyVal { | |
def value: String = self | |
} | |
} | |
opaque type Email = String | |
object Email { | |
def apply(value: String): Email = value | |
implicit class Ops(val self: Email) extends AnyVal { | |
def value: String = self | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment