diff --git a/impl/echo.go b/impl/echo.go index 4b294fa..61df394 100644 --- a/impl/echo.go +++ b/impl/echo.go @@ -4,7 +4,7 @@ package impl // Comes handy when you need to mock a unit func Echo() *Impl { return &Impl{ - Call: func(data []byte) (resp []byte, err error) { + actor: func(data []byte) (resp []byte, err error) { return data, nil }, } diff --git a/impl/impl.go b/impl/impl.go index 5977dfa..d458ca3 100644 --- a/impl/impl.go +++ b/impl/impl.go @@ -2,14 +2,10 @@ package impl type ( Impl struct { - Call func([]byte) ([]byte, error) + actor func([]byte) ([]byte, error) } ) -func (i *Impl) Units() []string { - return []string{} -} - func New(name string) *Impl { switch name { case "units.throttler.Throttler": @@ -18,3 +14,11 @@ func New(name string) *Impl { return nil } } + +func (i *Impl) Call(data []byte) (resp []byte, err error) { + return i.actor(data) +} + +func (i *Impl) Units() []string { + return []string{} +} diff --git a/impl/throttler.go b/impl/throttler.go index 2db974f..ed94fa3 100644 --- a/impl/throttler.go +++ b/impl/throttler.go @@ -2,7 +2,7 @@ package impl func Throttler() *Impl { return &Impl{ - Call: func(data []byte) (resp []byte, err error) { + actor: func(data []byte) (resp []byte, err error) { return data, nil }, }