gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/server/wrapper.go (about) 1 package server 2 3 import ( 4 "context" 5 ) 6 7 // HandlerFunc represents a single method of a handler. It's used primarily 8 // for the wrappers. What's handed to the actual method is the concrete 9 // request and response types. 10 type HandlerFunc func(ctx context.Context, req Request, rsp interface{}) error 11 12 // SubscriberFunc represents a single method of a subscriber. It's used primarily 13 // for the wrappers. What's handed to the actual method is the concrete 14 // publication message. 15 type SubscriberFunc func(ctx context.Context, msg Message) error 16 17 // HandlerWrapper wraps the HandlerFunc and returns the equivalent 18 type HandlerWrapper func(HandlerFunc) HandlerFunc 19 20 // SubscriberWrapper wraps the SubscriberFunc and returns the equivalent 21 type SubscriberWrapper func(SubscriberFunc) SubscriberFunc 22 23 // StreamWrapper wraps a Stream interface and returns the equivalent. 24 // Because streams exist for the lifetime of a method invocation this 25 // is a convenient way to wrap a Stream as its in use for trace, monitoring, 26 // metrics, etc. 27 type StreamWrapper func(Stream) Stream