
With this change, we define a simple server and client framework to start generating code against. We define a simple handler system with back registration into the server definition. From here, we can start generating code against the handlers. Signed-off-by: Stephen J Day <stephen.day@docker.com>
14 lines
323 B
Go
14 lines
323 B
Go
package mgrpc
|
|
|
|
import "context"
|
|
|
|
type Handler interface {
|
|
Handle(ctx context.Context, req interface{}) (interface{}, error)
|
|
}
|
|
|
|
type HandlerFunc func(ctx context.Context, req interface{}) (interface{}, error)
|
|
|
|
func (fn HandlerFunc) Handle(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return fn(ctx, req)
|
|
}
|