Skip to content

Instantly share code, notes, and snippets.

@richdougherty
Last active April 6, 2018 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richdougherty/0a4d2124bff7a1a9db1676e5b4d92a05 to your computer and use it in GitHub Desktop.
Save richdougherty/0a4d2124bff7a1a9db1676e5b4d92a05 to your computer and use it in GitHub Desktop.
Richer types for akka-grpc generated code
trait GreeterService {
...
}
object GreeterService extends GreeterServiceCompanion[GreeterService] {
override val name = "helloworld.GreeterService"
...
}
class GreeterServiceClient(channel: Channel, options: CallOptions)(implicit mat: Materializer, ex: ExecutionContext) extends GreeterService {
...
}
object GreeterServiceClient extends GreeterServiceClientCompanion[GreeterService] {
override def apply(channel: Channel)(implicit mat: Materializer, ex: ExecutionContext): GreeterService = ...
...
}
object GreeterServiceHandler extends GreeterServiceHandlerCompanion[GreeterService] {
// I'm not sure if a PartialFunction is OK or if we want a richer return type for this method too.
override def apply(implementation: GreeterService)(implicit mat: Materializer): PartialFunction[HttpRequest, Future[HttpResponse]] = {
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment