micro/server/server_wrapper.go

22 lines
813 B
Go
Raw Normal View History

package server
import (
"golang.org/x/net/context"
)
2015-12-03 00:16:44 +03:00
// HandlerFunc represents a single method of a handler. It's used primarily
// for the wrappers. What's handed to the actual method is the concrete
// request and response types.
2015-12-02 23:56:50 +03:00
type HandlerFunc func(ctx context.Context, req Request, rsp interface{}) error
2015-12-03 00:16:44 +03:00
// SubscriberFunc represents a single method of a subscriber. It's used primarily
// for the wrappers. What's handed to the actual method is the concrete
// publication message.
2015-12-02 23:56:50 +03:00
type SubscriberFunc func(ctx context.Context, msg Publication) error
2015-12-02 14:54:36 +03:00
2015-12-03 00:16:44 +03:00
// HandlerWrapper wraps the HandlerFunc and returns the equivalent
2015-12-02 14:54:36 +03:00
type HandlerWrapper func(HandlerFunc) HandlerFunc
2015-12-03 00:16:44 +03:00
// SubscriberWrapper wraps the SubscriberFunc and returns the equivalent
2015-12-02 14:54:36 +03:00
type SubscriberWrapper func(SubscriberFunc) SubscriberFunc