Last active
November 1, 2017 17:18
-
-
Save travisjeffery/475d38ebbc127ef53ed9016a15482d41 to your computer and use it in GitHub Desktop.
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
// endpoints.go | |
func makeGetUserEndpoint(userService user.Service) endpoint.Endpoint { | |
return func(ctx context.Context, request interface{}) (interface{}, error) { | |
req := request.(*GetUserRequest) | |
user, err := userService.GetUser(req.User) | |
if err != nil { | |
return &GetUserResponse{Error: err.(*Error)}, nil | |
} | |
return &GetUserResponse{User: user}, nil | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment