Created
November 25, 2018 23:22
-
-
Save cn007b/bd9ddf8e813d10e3fd6cef605f55e467 to your computer and use it in GitHub Desktop.
eop - Implementation2 service
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
// service | |
func MustSignUp(username string) { | |
mustValidation(username) | |
mustSignUpFacebook(username) | |
mustSignUpTwitter(username) | |
mustSignUpPinterest(username) | |
} | |
func mustValidation(username string) { | |
if len(username) == 0 { | |
panic(c.ErrorUsernameBlank) | |
} | |
} | |
func mustSignUpFacebook(username string) { | |
if username == "bond" { | |
panic(c.ErrorUsernameAlreadyTaken) | |
} | |
} | |
func mustSignUpTwitter(username string) { | |
if username == "leiter" { | |
panic(c.ErrorUsernameAlreadyTaken) | |
} | |
} | |
func mustSignUpPinterest(username string) { | |
if username == "q" { | |
panic(c.ErrorUsernameAlreadyTaken) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment