20 lines
440 B
Go
20 lines
440 B
Go
package mygrpc
|
|
|
|
import (
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
const (
|
|
ServerTimeoutCode codes.Code = 10000
|
|
ClientTimeoutCode codes.Code = 10001
|
|
)
|
|
|
|
func GrpcClientTimeout(format string, args ...interface{}) error {
|
|
return status.Newf(ClientTimeoutCode, format, args).Err()
|
|
}
|
|
|
|
func GrpcServerTimeout(format string, args ...interface{}) error {
|
|
return status.Newf(ServerTimeoutCode, format, args...).Err()
|
|
}
|