Suppose we have a go api containing a grpc server implementation.
This grpc server method has to do a variety of tasks which needs to be abstracted as a different service within the same api.
Is there a way to inject this new service in the grpc server?
Sample code:
package grpcserver
func (g *GrpcServer) GrpcServerExample(ctx context.Context, r *grpcpackage.SampleGrpcRequest) (*grpcpackage.SampleGrpcResponse, error) {
service := differentService{} //how to inject this instead of creating here
result := service.DoSomething()
return nil,nil
}