Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertDynamicMessageToHttpBody(dynamicMessage *dynamicpb.Message) (*httpbody.HttpBody, error)
- func HandleErrorWithLogger(logger logger.Logger) runtime.ErrorHandlerFunc
- func HttpResponseBodyModify(ctx context.Context, w http.ResponseWriter, msg proto.Message) error
- func IncomingHeadersToMetadata(ctx context.Context, req *http.Request) metadata.MD
- func JSONCamelCase(s string) string
- func NewGrpcConnPool(addr string, poolOpt ...loadbalance.PoolOptionsBuildOption) loadbalance.Pool
- func NewGrpcEndpoint(addr string, pool loadbalance.Pool) loadbalance.Endpoint
- func NewGrpcServer(opts *GrpcServerOptions, lb *GrpcLoadBalancer) *grpc.Server
- func NewJsonDecoder(r io.Reader) runtime.Decoder
- func NewLoadBalanceEndpoint(lb loadbalance.BalanceType, endpoints []*api.EndpointMeta) ([]loadbalance.Endpoint, error)
- func NewMaskDecoder(dec runtime.Decoder) *maskDecoder
- func SetUpdateMaskFields(message protoreflect.ProtoMessage, fields []string)
- func UrlQueryToProtoMessageField(pb proto.Message, value url.Values) error
- type BinaryDecoder
- type ClientSideStream
- type CorsHandler
- type EndpointServer
- type EventSourceMarshaler
- type Exception
- func (e *Exception) Name() string
- func (e *Exception) Priority() int
- func (e *Exception) SetPriority(priority int)
- func (e *Exception) StreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) (err error)
- func (e *Exception) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- type FormDataDecoder
- type FormDataMarshaler
- type FormUrlEncodedDecoder
- type FormUrlEncodedMarshaler
- type FormatDataDecoder
- type GatewayConfig
- type GatewayServer
- func (g *GatewayServer) DeleteHandlerClient(ctx context.Context, pd ProtobufDescription) error
- func (g *GatewayServer) DeleteLoadBalance(pd ProtobufDescription)
- func (g *GatewayServer) DeleteLocalService(pd ProtobufDescription)
- func (g *GatewayServer) GetLoadbalanceName() loadbalance.BalanceType
- func (g *GatewayServer) GetOptions() *GrpcServerOptions
- func (g *GatewayServer) RegisterHandlerClient(ctx context.Context, pd ProtobufDescription) error
- func (g *GatewayServer) RegisterLocalService(ctx context.Context, pd ProtobufDescription, sd *grpc.ServiceDesc, ss any) error
- func (g *GatewayServer) RegisterService(ctx context.Context, pd ProtobufDescription, lb loadbalance.LoadBalance) error
- func (g *GatewayServer) Start()
- func (g *GatewayServer) UpdateLoadbalance(pd ProtobufDescription, lb loadbalance.LoadBalance)
- type GrpcLoadBalancer
- func (g *GrpcLoadBalancer) Delete(pd ProtobufDescription)
- func (g *GrpcLoadBalancer) Name() loadbalance.BalanceType
- func (g *GrpcLoadBalancer) Register(lb loadbalance.LoadBalance, pd ProtobufDescription)
- func (g *GrpcLoadBalancer) Select(method string, args ...interface{}) (loadbalance.Endpoint, error)
- type GrpcProxy
- type GrpcProxyMiddleware
- type GrpcRequest
- type GrpcRequestImpl
- func (g *GrpcRequestImpl) GetCallOptions() []grpc.CallOption
- func (g *GrpcRequestImpl) GetContext() context.Context
- func (g *GrpcRequestImpl) GetFullMethodName() string
- func (g *GrpcRequestImpl) GetIn() proto.Message
- func (g *GrpcRequestImpl) GetInType() protoreflect.MessageDescriptor
- func (g *GrpcRequestImpl) GetMarshaler() runtime.Marshaler
- func (g *GrpcRequestImpl) GetOut() proto.Message
- func (g *GrpcRequestImpl) GetOutType() protoreflect.MessageDescriptor
- func (g *GrpcRequestImpl) GetPathParams() map[string]string
- func (g *GrpcRequestImpl) GetReq() *http.Request
- type GrpcRequestOptions
- func WithGatewayCallOptions(options ...grpc.CallOption) GrpcRequestOptions
- func WithGatewayMarshaler(m runtime.Marshaler) GrpcRequestOptions
- func WithGatewayPathParams(pathParams map[string]string) GrpcRequestOptions
- func WithGatewayReq(r *http.Request) GrpcRequestOptions
- func WithIn(in proto.Message) GrpcRequestOptions
- func WithOut(out proto.Message) GrpcRequestOptions
- type GrpcServerOptions
- type HttpEndpoint
- type HttpEndpointImpl
- func (h *HttpEndpointImpl) DeleteEndpoint(ctx context.Context, pd ProtobufDescription, mux *runtime.ServeMux) error
- func (h *HttpEndpointImpl) NotFound(w http.ResponseWriter, r *http.Request, pathParams map[string]string)
- func (h *HttpEndpointImpl) RegisterHandlerClient(ctx context.Context, pd ProtobufDescription, mux *runtime.ServeMux) error
- type HttpEndpointItem
- type HttpForwardGrpcEndpoint
- type HttpProtobufStream
- type HttpProtobufStreamImpl
- func (p *HttpProtobufStreamImpl) ContentType(v interface{}) string
- func (*HttpProtobufStreamImpl) Marshal(value interface{}) ([]byte, error)
- func (p *HttpProtobufStreamImpl) NewDecoder(reader io.Reader) runtime.Decoder
- func (p *HttpProtobufStreamImpl) NewEncoder(writer io.Writer) runtime.Encoder
- func (p *HttpProtobufStreamImpl) Unmarshal(data []byte, value interface{}) error
- type JSONMarshaler
- type LengthPrefixMarshalerOption
- type LengthPrefixUnmarshalerOption
- type LoggerImpl
- func (l *LoggerImpl) Debug(ctx context.Context, args ...interface{})
- func (l *LoggerImpl) Debugf(ctx context.Context, format string, args ...interface{})
- func (l *LoggerImpl) Error(ctx context.Context, err error)
- func (l *LoggerImpl) Errorf(ctx context.Context, format string, args ...interface{})
- func (l *LoggerImpl) Info(ctx context.Context, args ...interface{})
- func (l *LoggerImpl) Infof(ctx context.Context, format string, args ...interface{})
- func (l *LoggerImpl) Logurs() *logrus.Logger
- func (l *LoggerImpl) SetReportCaller(reportCaller bool)
- func (l *LoggerImpl) Warn(ctx context.Context, args ...interface{})
- func (l *LoggerImpl) Warnf(ctx context.Context, format string, args ...interface{})
- func (l *LoggerImpl) WithField(key string, value interface{}) logger.Logger
- func (l *LoggerImpl) WithFields(fields logrus.Fields) logger.Logger
- type LoggerMiddleware
- func (log *LoggerMiddleware) Name() string
- func (log *LoggerMiddleware) Priority() int
- func (log *LoggerMiddleware) SetPriority(priority int)
- func (log *LoggerMiddleware) StreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) (err error)
- func (log *LoggerMiddleware) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (rsp interface{}, err error)
- type ProtobufDescription
- type RawBinaryUnmarshaler
- type ServerSideStream
- type StreamClient
- type Template
- type WebsocketForwarder
Constants ¶
View Source
const ( XRequestID = "x-request-id" XUID = "x-uid" XAccessKey = "x-access-key" XHttpMethod = "x-http-method" XRemoteAddr = "x-http-forwarded-for" XProtocol = "x-http-protocol" XHttpURI = "x-http-uri" XIdentity = "x-identity" )
View Source
const ClientStreamContentType = "application/begonia-client-stream"
View Source
const GatewayXParams = "x-gateway-params"
Variables ¶
View Source
var Log logger.Logger
Functions ¶
func ConvertDynamicMessageToHttpBody ¶
func (m *RawBinaryUnmarshaler) NewDecoder(r io.Reader) runtime.Decoder { return &BinaryDecoder{"Data", r} }
func HandleErrorWithLogger ¶
func HandleErrorWithLogger(logger logger.Logger) runtime.ErrorHandlerFunc
func HttpResponseBodyModify ¶
func JSONCamelCase ¶
func NewGrpcConnPool ¶
func NewGrpcConnPool(addr string, poolOpt ...loadbalance.PoolOptionsBuildOption) loadbalance.Pool
NewGrpcConnPool 创建一个grpc连接池
func NewGrpcEndpoint ¶
func NewGrpcEndpoint(addr string, pool loadbalance.Pool) loadbalance.Endpoint
func NewGrpcServer ¶
func NewGrpcServer(opts *GrpcServerOptions, lb *GrpcLoadBalancer) *grpc.Server
func NewLoadBalanceEndpoint ¶
func NewLoadBalanceEndpoint(lb loadbalance.BalanceType, endpoints []*api.EndpointMeta) ([]loadbalance.Endpoint, error)
func NewMaskDecoder ¶
func SetUpdateMaskFields ¶
func SetUpdateMaskFields(message protoreflect.ProtoMessage, fields []string)
Types ¶
type BinaryDecoder ¶
type BinaryDecoder struct {
// contains filtered or unexported fields
}
func (*BinaryDecoder) Decode ¶
func (d *BinaryDecoder) Decode(v interface{}) error
type ClientSideStream ¶
type ClientSideStream interface { Send(protoreflect.ProtoMessage) error CloseAndRecv() (protoreflect.ProtoMessage, error) grpc.ClientStream }
type CorsHandler ¶
type CorsHandler struct {
Cors []string
}
type EndpointServer ¶
type EventSourceMarshaler ¶
type EventSourceMarshaler struct {
JSONMarshaler
}
func NewEventSourceMarshaler ¶
func NewEventSourceMarshaler() *EventSourceMarshaler
func (*EventSourceMarshaler) ContentType ¶
func (m *EventSourceMarshaler) ContentType(v interface{}) string
func (*EventSourceMarshaler) Marshal ¶
func (m *EventSourceMarshaler) Marshal(v interface{}) ([]byte, error)
type Exception ¶
type Exception struct {
// contains filtered or unexported fields
}
func NewException ¶
func (*Exception) SetPriority ¶
func (*Exception) StreamInterceptor ¶
func (e *Exception) StreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error)
func (*Exception) UnaryInterceptor ¶
func (e *Exception) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
type FormDataDecoder ¶
type FormDataDecoder struct {
// contains filtered or unexported fields
}
func (*FormDataDecoder) Decode ¶
func (f *FormDataDecoder) Decode(v interface{}) error
func (*FormDataDecoder) SetBoundary ¶
func (f *FormDataDecoder) SetBoundary(boundary string)
type FormDataMarshaler ¶
func NewFormDataMarshaler ¶
func NewFormDataMarshaler() *FormDataMarshaler
func (*FormDataMarshaler) ContentType ¶
func (f *FormDataMarshaler) ContentType(v interface{}) string
func (*FormDataMarshaler) NewDecoder ¶
func (f *FormDataMarshaler) NewDecoder(r io.Reader) runtime.Decoder
type FormUrlEncodedDecoder ¶
type FormUrlEncodedDecoder struct {
// contains filtered or unexported fields
}
func (*FormUrlEncodedDecoder) Decode ¶
func (f *FormUrlEncodedDecoder) Decode(v interface{}) error
type FormUrlEncodedMarshaler ¶
func NewFormUrlEncodedMarshaler ¶
func NewFormUrlEncodedMarshaler() *FormUrlEncodedMarshaler
func (*FormUrlEncodedMarshaler) ContentType ¶
func (f *FormUrlEncodedMarshaler) ContentType(v interface{}) string
func (*FormUrlEncodedMarshaler) NewDecoder ¶
func (f *FormUrlEncodedMarshaler) NewDecoder(r io.Reader) runtime.Decoder
type FormatDataDecoder ¶
type FormatDataDecoder interface {
SetBoundary(string)
}
type GatewayConfig ¶
type GatewayServer ¶
type GatewayServer struct {
// contains filtered or unexported fields
}
func Get ¶
func Get() *GatewayServer
func New ¶
func New(cfg *GatewayConfig, opts *GrpcServerOptions) *GatewayServer
func NewGateway ¶
func NewGateway(cfg *GatewayConfig, opts *GrpcServerOptions) *GatewayServer
func (*GatewayServer) DeleteHandlerClient ¶
func (g *GatewayServer) DeleteHandlerClient(ctx context.Context, pd ProtobufDescription) error
func (*GatewayServer) DeleteLoadBalance ¶
func (g *GatewayServer) DeleteLoadBalance(pd ProtobufDescription)
func (*GatewayServer) DeleteLocalService ¶
func (g *GatewayServer) DeleteLocalService(pd ProtobufDescription)
func (*GatewayServer) GetLoadbalanceName ¶
func (g *GatewayServer) GetLoadbalanceName() loadbalance.BalanceType
func (*GatewayServer) GetOptions ¶
func (g *GatewayServer) GetOptions() *GrpcServerOptions
func (*GatewayServer) RegisterHandlerClient ¶
func (g *GatewayServer) RegisterHandlerClient(ctx context.Context, pd ProtobufDescription) error
func (*GatewayServer) RegisterLocalService ¶
func (g *GatewayServer) RegisterLocalService(ctx context.Context, pd ProtobufDescription, sd *grpc.ServiceDesc, ss any) error
func (*GatewayServer) RegisterService ¶
func (g *GatewayServer) RegisterService(ctx context.Context, pd ProtobufDescription, lb loadbalance.LoadBalance) error
func (*GatewayServer) Start ¶
func (g *GatewayServer) Start()
func (*GatewayServer) UpdateLoadbalance ¶
func (g *GatewayServer) UpdateLoadbalance(pd ProtobufDescription, lb loadbalance.LoadBalance)
type GrpcLoadBalancer ¶
type GrpcLoadBalancer struct {
// contains filtered or unexported fields
}
func NewGrpcLoadBalancer ¶
func NewGrpcLoadBalancer() *GrpcLoadBalancer
func (*GrpcLoadBalancer) Delete ¶
func (g *GrpcLoadBalancer) Delete(pd ProtobufDescription)
func (*GrpcLoadBalancer) Name ¶
func (g *GrpcLoadBalancer) Name() loadbalance.BalanceType
func (*GrpcLoadBalancer) Register ¶
func (g *GrpcLoadBalancer) Register(lb loadbalance.LoadBalance, pd ProtobufDescription)
func (*GrpcLoadBalancer) Select ¶
func (g *GrpcLoadBalancer) Select(method string, args ...interface{}) (loadbalance.Endpoint, error)
type GrpcProxy ¶
type GrpcProxy struct {
// contains filtered or unexported fields
}
func NewGrpcProxy ¶
func NewGrpcProxy(lb *GrpcLoadBalancer, middlewares ...GrpcProxyMiddleware) *GrpcProxy
type GrpcProxyMiddleware ¶
type GrpcProxyMiddleware func(srv interface{}, serverStream grpc.ServerStream) error
type GrpcRequest ¶
type GrpcRequest interface { GetContext() context.Context // TODO:with gateway GetMarshaler() runtime.Marshaler GetReq() *http.Request GetPathParams() map[string]string GetIn() proto.Message GetOut() proto.Message GetOutType() protoreflect.MessageDescriptor GetInType() protoreflect.MessageDescriptor GetFullMethodName() string GetCallOptions() []grpc.CallOption }
func NewGrpcRequest ¶
func NewGrpcRequest(ctx context.Context, inType protoreflect.MessageDescriptor, outType protoreflect.MessageDescriptor, fullMethodName string, opts ...GrpcRequestOptions) GrpcRequest
type GrpcRequestImpl ¶
type GrpcRequestImpl struct {
// contains filtered or unexported fields
}
func (*GrpcRequestImpl) GetCallOptions ¶
func (g *GrpcRequestImpl) GetCallOptions() []grpc.CallOption
func (*GrpcRequestImpl) GetContext ¶
func (g *GrpcRequestImpl) GetContext() context.Context
func (*GrpcRequestImpl) GetFullMethodName ¶
func (g *GrpcRequestImpl) GetFullMethodName() string
func (*GrpcRequestImpl) GetIn ¶
func (g *GrpcRequestImpl) GetIn() proto.Message
func (*GrpcRequestImpl) GetInType ¶
func (g *GrpcRequestImpl) GetInType() protoreflect.MessageDescriptor
func (*GrpcRequestImpl) GetMarshaler ¶
func (g *GrpcRequestImpl) GetMarshaler() runtime.Marshaler
func (*GrpcRequestImpl) GetOut ¶
func (g *GrpcRequestImpl) GetOut() proto.Message
func (*GrpcRequestImpl) GetOutType ¶
func (g *GrpcRequestImpl) GetOutType() protoreflect.MessageDescriptor
func (*GrpcRequestImpl) GetPathParams ¶
func (g *GrpcRequestImpl) GetPathParams() map[string]string
func (*GrpcRequestImpl) GetReq ¶
func (g *GrpcRequestImpl) GetReq() *http.Request
type GrpcRequestOptions ¶
type GrpcRequestOptions func(req *GrpcRequestImpl)
func WithGatewayCallOptions ¶
func WithGatewayCallOptions(options ...grpc.CallOption) GrpcRequestOptions
func WithGatewayMarshaler ¶
func WithGatewayMarshaler(m runtime.Marshaler) GrpcRequestOptions
func WithGatewayPathParams ¶
func WithGatewayPathParams(pathParams map[string]string) GrpcRequestOptions
func WithGatewayReq ¶
func WithGatewayReq(r *http.Request) GrpcRequestOptions
func WithIn ¶
func WithIn(in proto.Message) GrpcRequestOptions
func WithOut ¶
func WithOut(out proto.Message) GrpcRequestOptions
type GrpcServerOptions ¶
type GrpcServerOptions struct { Middlewares []GrpcProxyMiddleware Options []grpc.ServerOption PoolOptions []loadbalance.PoolOptionsBuildOption HttpMiddlewares []runtime.ServeMuxOption HttpHandlers []func(http.Handler) http.Handler }
type HttpEndpoint ¶
type HttpEndpoint interface { RegisterHandlerClient(ctx context.Context, pd ProtobufDescription, mux *runtime.ServeMux) error DeleteEndpoint(ctx context.Context, pd ProtobufDescription, mux *runtime.ServeMux) error }
func NewHttpEndpoint ¶
func NewHttpEndpoint(client HttpForwardGrpcEndpoint) (HttpEndpoint, error)
func NewHttpServer ¶
func NewHttpServer(addr string, poolOpt ...loadbalance.PoolOptionsBuildOption) (HttpEndpoint, error)
type HttpEndpointImpl ¶
type HttpEndpointImpl struct {
// contains filtered or unexported fields
}
func (*HttpEndpointImpl) DeleteEndpoint ¶
func (h *HttpEndpointImpl) DeleteEndpoint(ctx context.Context, pd ProtobufDescription, mux *runtime.ServeMux) error
func (*HttpEndpointImpl) NotFound ¶
func (h *HttpEndpointImpl) NotFound(w http.ResponseWriter, r *http.Request, pathParams map[string]string)
func (*HttpEndpointImpl) RegisterHandlerClient ¶
func (h *HttpEndpointImpl) RegisterHandlerClient(ctx context.Context, pd ProtobufDescription, mux *runtime.ServeMux) error
type HttpEndpointItem ¶
type HttpEndpointItem struct { Pattern runtime.Pattern `json:"-"` Template *Template HttpMethod string FullMethodName string HttpUri string PathParams []string In protoreflect.MessageDescriptor Out protoreflect.MessageDescriptor IsClientStream bool IsServerStream bool InName string OutName string Pkg string InPkg string OutPkg string HttpResponse string `json:"http_response"` }
type HttpForwardGrpcEndpoint ¶
type HttpForwardGrpcEndpoint interface { Request(req GrpcRequest) (proto.Message, runtime.ServerMetadata, error) ServerSideStream(req GrpcRequest) (ServerSideStream, error) ClientSideStream(req GrpcRequest) (ClientSideStream, error) Stream(req GrpcRequest) (StreamClient, error) }
func NewEndpoint ¶
func NewEndpoint(pool loadbalance.Pool) HttpForwardGrpcEndpoint
type HttpProtobufStream ¶
ProtobufWithLengthPrefix 是一个编码器,它将消息编码为长度前缀的字节切片 方便stream处理,不需要使用分隔符,将连续的消息流转换为字节流
func NewProtobufWithLengthPrefix ¶
func NewProtobufWithLengthPrefix() HttpProtobufStream
type HttpProtobufStreamImpl ¶
type HttpProtobufStreamImpl struct {
*runtime.ProtoMarshaller
}
func (*HttpProtobufStreamImpl) ContentType ¶
func (p *HttpProtobufStreamImpl) ContentType(v interface{}) string
func (*HttpProtobufStreamImpl) Marshal ¶
func (*HttpProtobufStreamImpl) Marshal(value interface{}) ([]byte, error)
Marshal 将消息编码为长度前缀的字节切片
func (*HttpProtobufStreamImpl) NewDecoder ¶
func (p *HttpProtobufStreamImpl) NewDecoder(reader io.Reader) runtime.Decoder
func (*HttpProtobufStreamImpl) NewEncoder ¶
func (p *HttpProtobufStreamImpl) NewEncoder(writer io.Writer) runtime.Encoder
func (*HttpProtobufStreamImpl) Unmarshal ¶
func (p *HttpProtobufStreamImpl) Unmarshal(data []byte, value interface{}) error
Unmarshal 将消息解码为长度前缀的字节切片
type JSONMarshaler ¶
func NewJSONMarshaler ¶
func NewJSONMarshaler() *JSONMarshaler
func (*JSONMarshaler) ContentType ¶
func (m *JSONMarshaler) ContentType(v interface{}) string
func (*JSONMarshaler) Marshal ¶
func (m *JSONMarshaler) Marshal(v interface{}) ([]byte, error)
type LoggerImpl ¶
func (*LoggerImpl) Debug ¶
func (l *LoggerImpl) Debug(ctx context.Context, args ...interface{})
func (*LoggerImpl) Debugf ¶
func (l *LoggerImpl) Debugf(ctx context.Context, format string, args ...interface{})
func (*LoggerImpl) Errorf ¶
func (l *LoggerImpl) Errorf(ctx context.Context, format string, args ...interface{})
func (*LoggerImpl) Info ¶
func (l *LoggerImpl) Info(ctx context.Context, args ...interface{})
func (*LoggerImpl) Infof ¶
func (l *LoggerImpl) Infof(ctx context.Context, format string, args ...interface{})
func (*LoggerImpl) Logurs ¶
func (l *LoggerImpl) Logurs() *logrus.Logger
func (*LoggerImpl) SetReportCaller ¶
func (l *LoggerImpl) SetReportCaller(reportCaller bool)
func (*LoggerImpl) Warn ¶
func (l *LoggerImpl) Warn(ctx context.Context, args ...interface{})
func (*LoggerImpl) Warnf ¶
func (l *LoggerImpl) Warnf(ctx context.Context, format string, args ...interface{})
func (*LoggerImpl) WithField ¶
func (l *LoggerImpl) WithField(key string, value interface{}) logger.Logger
func (*LoggerImpl) WithFields ¶
func (l *LoggerImpl) WithFields(fields logrus.Fields) logger.Logger
type LoggerMiddleware ¶
type LoggerMiddleware struct {
// contains filtered or unexported fields
}
func NewLoggerMiddleware ¶
func NewLoggerMiddleware(log logger.Logger) *LoggerMiddleware
func (*LoggerMiddleware) Name ¶
func (log *LoggerMiddleware) Name() string
func (*LoggerMiddleware) Priority ¶
func (log *LoggerMiddleware) Priority() int
func (*LoggerMiddleware) SetPriority ¶
func (log *LoggerMiddleware) SetPriority(priority int)
func (*LoggerMiddleware) StreamInterceptor ¶
func (log *LoggerMiddleware) StreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error)
func (*LoggerMiddleware) UnaryInterceptor ¶
func (log *LoggerMiddleware) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (rsp interface{}, err error)
type ProtobufDescription ¶
type ProtobufDescription interface { GetFileDescriptorSet() *descriptorpb.FileDescriptorSet GetMessageTypeByName(pkg string, name string) protoreflect.MessageDescriptor GetGatewayJsonSchema() string SetHttpResponse(option protoreflect.ExtensionType) error GetMessageTypeByFullName(fullName string) protoreflect.MessageDescriptor GetDescription() []byte }
func NewDescription ¶
func NewDescription(dir string) (ProtobufDescription, error)
func NewDescriptionFromBinary ¶
func NewDescriptionFromBinary(data []byte, outDir string) (ProtobufDescription, error)
type RawBinaryUnmarshaler ¶
type RawBinaryUnmarshaler runtime.HTTPBodyMarshaler
func NewRawBinaryUnmarshaler ¶
func NewRawBinaryUnmarshaler() *RawBinaryUnmarshaler
func (*RawBinaryUnmarshaler) ContentType ¶
func (m *RawBinaryUnmarshaler) ContentType(v interface{}) string
func (*RawBinaryUnmarshaler) Marshal ¶
func (m *RawBinaryUnmarshaler) Marshal(v interface{}) ([]byte, error)
func (*RawBinaryUnmarshaler) NewDecoder ¶
func (m *RawBinaryUnmarshaler) NewDecoder(r io.Reader) runtime.Decoder
type ServerSideStream ¶
type ServerSideStream interface { Recv() (protoreflect.ProtoMessage, error) grpc.ClientStream }
type StreamClient ¶
type StreamClient interface { Send(protoreflect.ProtoMessage) error Recv() (protoreflect.ProtoMessage, error) grpc.ClientStream }
type Template ¶
type Template struct { // Version is the version number of the format. Version int // OpCodes is a sequence of operations. OpCodes []int // Pool is a constant pool Pool []string // Verb is a VERB part in the template. Verb string // Fields is a list of field paths bound in this template. Fields []string // Original template (example: /v1/a_bit_of_everything) Template string }
type WebsocketForwarder ¶
type WebsocketForwarder interface { http.ResponseWriter // Read() ([]byte, error) Write([]byte) (int, error) Close() error CloseConn() error NextReader() (io.Reader, error) }
func NewWebsocketForwarder ¶
func NewWebsocketForwarder(w http.ResponseWriter, req *http.Request, responseType int) (WebsocketForwarder, error)
Click to show internal directories.
Click to hide internal directories.