Created
September 30, 2019 16:44
-
-
Save phuctm97/79244d20de052bede13203ee0cb7dee5 to your computer and use it in GitHub Desktop.
Go RESTful Series
This file contains hidden or 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
package users | |
type mockUserRepository struct{} | |
func (r *mockUserRepository) ExistsByUsername(username string) (bool, error) { | |
if username == "existed" { | |
return true, nil | |
} | |
return false, nil | |
} | |
func (r *mockUserRepository) ExistsByEmail(email string) (bool, error) { | |
if email == "[email protected]" { | |
return true, nil | |
} | |
return false, nil | |
} | |
// NewMockUserRepository returns a new mock user repository. | |
func NewMockUserRepository() UserRepository { | |
return new(mockUserRepository) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment