We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这儿有道题, 从实际的项目中简化而来:
case class User(id: Long, nickname: String, password: String, mobile: String) object Users { def userBy(mobile: String): Option[User] = if (mobile == "01234567890") Some(User(1L, "allen", "******", "01234567890")) else None def authenticate(mobile: String, password: String): Either[User, String] = ??? } assert(Users.authenticate("allen", "******") == Right("Invalid mobile")) assert(Users.authenticate("01234567891", "******") == Right("Mobile not found")) assert(Users.authenticate("01234567890", "??????") == Right("Invalid password")) assert(Users.authenticate("01234567890", "******") == Left(User(1L, "allen", "******", "01234567890")))
请根据assert提示实现authenticate.
assert
authenticate
The text was updated successfully, but these errors were encountered:
No branches or pull requests
这儿有道题, 从实际的项目中简化而来:
请根据
assert
提示实现authenticate
.The text was updated successfully, but these errors were encountered: