package micro import ( "context" "git.nspix.com/golang/micro/gateway" ) type ( HandleOptions struct { HttpMethod string } HandleOption func(o *HandleOptions) HandleFunc func(ctx gateway.Context) (err error) Application interface { RegisterHandle(method string, cb HandleFunc) (err error) //注册一个处理器 NewRequest(service, method string, payload interface{}) (err error) //创建一个rpc请求 } Server interface { Start(ctx context.Context) (err error) Stop() (err error) } Request struct { ServiceName string Method string Body interface{} client *Client } Response interface { StatusCode() int Error() error Decode(i interface{}) error } ) func (r *Request) Do(ctx context.Context) (Response, error) { return r.client.Do(ctx, r) } func WithHttpMethod(method string) HandleOption { return func(o *HandleOptions) { o.HttpMethod = method } }