Created
September 9, 2017 18:10
-
-
Save knightpop/a385f1323d64395bbbbad3fad2554406 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
def getUserIdOrDeviceIdOrCarSerialId( | |
id: Either[UserId, Either[DeviceUuid, CarSerialId]] | |
): Long = id match { | |
case Left(userId) => userId + 1 | |
case Right(Left(deviceUuid)) => deviceUuid + 2 | |
case Right(Right(carSerialId)) => carSerialId + 3 | |
} | |
getUserIdOrDeviceIdOrCarSerialId(Left(taggedUserId)) | |
getUserIdOrDeviceIdOrCarSerialId(Right(Left(taggedDeviceUuid))) | |
getUserIdOrDeviceIdOrCarSerialId(Right(Right(taggedCarSerialId))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment