Created
June 25, 2020 21:51
-
-
Save RicardoLinck/0b9c77bd52c7d07f3c0c99da6ae18773 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
| func (*server) Greet(ctx context.Context, req *greetpb.GreetRequest) (*greetpb.GreetResponse, error) { | |
| log.Println("Greet rpc invoked!") | |
| time.Sleep(500 * time.Millisecond) | |
| if ctx.Err() == context.Canceled { | |
| return nil, status.Error(codes.Canceled, "Client cancelled the request") | |
| } | |
| first := req.Greeting.FirstName | |
| return &greetpb.GreetResponse{ | |
| Result: fmt.Sprintf("Hello %s", first), | |
| }, nil | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment