1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-11-23 21:44:41 +02:00

feat: add test framework & refactor RPC server (#2579)

Co-authored-by: Rene Jochum <rene@jochum.dev>
This commit is contained in:
David Brouwer
2022-10-20 13:00:50 +02:00
committed by GitHub
parent c25dee7c8a
commit a3980c2308
54 changed files with 3703 additions and 2497 deletions

View File

@@ -6,14 +6,14 @@ import (
"go-micro.dev/v4/registry"
)
type rpcHandler struct {
type RpcHandler struct {
name string
handler interface{}
endpoints []*registry.Endpoint
opts HandlerOptions
}
func newRpcHandler(handler interface{}, opts ...HandlerOption) Handler {
func NewRpcHandler(handler interface{}, opts ...HandlerOption) Handler {
options := HandlerOptions{
Metadata: make(map[string]map[string]string),
}
@@ -40,7 +40,7 @@ func newRpcHandler(handler interface{}, opts ...HandlerOption) Handler {
}
}
return &rpcHandler{
return &RpcHandler{
name: name,
handler: handler,
endpoints: endpoints,
@@ -48,18 +48,18 @@ func newRpcHandler(handler interface{}, opts ...HandlerOption) Handler {
}
}
func (r *rpcHandler) Name() string {
func (r *RpcHandler) Name() string {
return r.name
}
func (r *rpcHandler) Handler() interface{} {
func (r *RpcHandler) Handler() interface{} {
return r.handler
}
func (r *rpcHandler) Endpoints() []*registry.Endpoint {
func (r *RpcHandler) Endpoints() []*registry.Endpoint {
return r.endpoints
}
func (r *rpcHandler) Options() HandlerOptions {
func (r *RpcHandler) Options() HandlerOptions {
return r.opts
}