Documentation ¶
Overview ¶
Package serviceutil provides service helper functions
Index ¶
- Variables
- func AsGrpcError(err error, message string, messageArgs ...interface{}) error
- func CloseContexts()
- func GetServiceConnection(serviceAddress string) (service *grpc.ClientConn, err error)
- func GetServiceConnectionWithDialOptions(serviceAddress string, dialOptions ...grpc.DialOption) (service *grpc.ClientConn, err error)
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidArgument = errors.New("One ore more request arguments are invalid")
ErrInvalidArgument indicates, that one or more provided arguments are invalid, e.g. required data is missing
Functions ¶
func AsGrpcError ¶
AsGrpcError returns a GRPC error, mapping internal errors and returning codes.Internal as default error. The error is logged If the given err is nil AsGrpcError returns nil
func GetServiceConnection ¶
func GetServiceConnection(serviceAddress string) (service *grpc.ClientConn, err error)
GetServiceConnection establishes connection to GRPC service at given URL. We are not waiting, til the service is up (no grpc.WithBlock())
func GetServiceConnectionWithDialOptions ¶ added in v0.0.4
func GetServiceConnectionWithDialOptions(serviceAddress string, dialOptions ...grpc.DialOption) (service *grpc.ClientConn, err error)
GetServiceConnectionWithDialOptions establishes connection to GRPC service at given URL with given dial options.
Types ¶
type Service ¶
type Service struct { Name string GrpcPublishPort string RestPort string MetricsPort string WaitGroup sync.WaitGroup Client interface{} NewClientFunc func(*grpc.ClientConn) interface{} RegisterServerFunc func(s *grpc.Server, srv interface{}) RegisterClientFunc func(ctx context.Context, mux *runtime.ServeMux, client interface{}) error Service interface{} ServeHTTP bool // enables REST endpoints SwaggerJsonPath string }
Service defines values to start a GRPC (and a REST) service
Click to show internal directories.
Click to hide internal directories.