Versions in this module Expand all Collapse all v1 v1.0.0 Dec 28, 2024 Changes in this version + const IsAtLeastVersion0_0_1 + const IsAtLeastVersion0_1_0 + const IsAtLeastVersion1_6_0 + const ProtocolGRPC + const ProtocolGRPCWeb + const ProtocolTriple + const TripleAttachement + const TripleContentType + const TripleRequestID + const TripleServiceGroup + const TripleServiceVersion + const TripleTraceID + const TripleTraceProtoBin + const TripleTraceRPCID + const TripleUnitInfo + const TripleUserAgent + const Version + func AppendToOutgoingContext(ctx context.Context, kv ...string) context.Context + func DecodeBinaryHeader(data string) ([]byte, error) + func EncodeBinaryHeader(data []byte) string + func ExtractFromOutgoingContext(ctx context.Context) http.Header + func FromIncomingContext(ctx context.Context) (http.Header, bool) + func IsEnded(err error) bool + func IsWireError(err error) bool + func MaxBytesHandler(h http.Handler, n int64) http.Handler + func NewOutgoingContext(ctx context.Context, data http.Header) context.Context + func SendHeader(ctx context.Context, header http.Header) error + func SetHeader(ctx context.Context, header http.Header) error + func SetTrailer(ctx context.Context, trailer http.Header) error + type AnyRequest interface + Any func() interface{} + Header func() http.Header + Peer func() Peer + Spec func() Spec + type AnyResponse interface + Any func() interface{} + Header func() http.Header + Trailer func() http.Header + type BidiStream struct + func (b *BidiStream) Conn() StreamingHandlerConn + func (b *BidiStream) ExportableHeader() http.Header + func (b *BidiStream) Peer() Peer + func (b *BidiStream) Receive(msg interface{}) error + func (b *BidiStream) RequestHeader() http.Header + func (b *BidiStream) ResponseHeader() http.Header + func (b *BidiStream) ResponseTrailer() http.Header + func (b *BidiStream) Send(msg interface{}) error + func (b *BidiStream) Spec() Spec + type BidiStreamForClient struct + func (b *BidiStreamForClient) CloseRequest() error + func (b *BidiStreamForClient) CloseResponse() error + func (b *BidiStreamForClient) Conn() (StreamingClientConn, error) + func (b *BidiStreamForClient) Peer() Peer + func (b *BidiStreamForClient) Receive(msg interface{}) error + func (b *BidiStreamForClient) RequestHeader() http.Header + func (b *BidiStreamForClient) ResponseHeader() http.Header + func (b *BidiStreamForClient) ResponseTrailer() http.Header + func (b *BidiStreamForClient) Send(msg interface{}) error + func (b *BidiStreamForClient) Spec() Spec + type Client struct + func NewClient(httpClient HTTPClient, url string, options ...ClientOption) *Client + func (c *Client) CallBidiStream(ctx context.Context) (*BidiStreamForClient, error) + func (c *Client) CallClientStream(ctx context.Context) (*ClientStreamForClient, error) + func (c *Client) CallServerStream(ctx context.Context, request *Request) (*ServerStreamForClient, error) + func (c *Client) CallUnary(ctx context.Context, request *Request, response *Response) error + type ClientOption interface + func WithAcceptCompression(name string, newDecompressor func() Decompressor, ...) ClientOption + func WithClientOptions(options ...ClientOption) ClientOption + func WithHessian2() ClientOption + func WithMsgPack() ClientOption + func WithProtoJSON() ClientOption + func WithSendCompression(name string) ClientOption + func WithSendGzip() ClientOption + func WithTimeout(timeout time.Duration) ClientOption + func WithTriple() ClientOption + type ClientStream struct + func (c *ClientStream) Conn() StreamingHandlerConn + func (c *ClientStream) Err() error + func (c *ClientStream) Msg() interface{} + func (c *ClientStream) Peer() Peer + func (c *ClientStream) Receive(msg interface{}) bool + func (c *ClientStream) RequestHeader() http.Header + func (c *ClientStream) Spec() Spec + type ClientStreamForClient struct + func (c *ClientStreamForClient) CloseAndReceive(response *Response) error + func (c *ClientStreamForClient) Conn() (StreamingClientConn, error) + func (c *ClientStreamForClient) Peer() Peer + func (c *ClientStreamForClient) RequestHeader() http.Header + func (c *ClientStreamForClient) Send(request interface{}) error + func (c *ClientStreamForClient) Spec() Spec + type Code uint32 + const CodeAborted + const CodeAlreadyExists + const CodeBizError + const CodeCanceled + const CodeDataLoss + const CodeDeadlineExceeded + const CodeFailedPrecondition + const CodeInternal + const CodeInvalidArgument + const CodeNotFound + const CodeOutOfRange + const CodePermissionDenied + const CodeResourceExhausted + const CodeUnauthenticated + const CodeUnavailable + const CodeUnimplemented + const CodeUnknown + func CodeOf(err error) Code + func (c *Code) UnmarshalText(data []byte) error + func (c Code) MarshalText() ([]byte, error) + func (c Code) String() string + type Codec interface + Marshal func(interface{}) ([]byte, error) + Name func() string + Unmarshal func([]byte, interface{}) error + type Compressor interface + Close func() error + Reset func(io.Writer) + type Decompressor interface + Close func() error + Reset func(io.Reader) error + type Error struct + func NewError(c Code, underlying error) *Error + func NewWireError(c Code, underlying error) *Error + func (e *Error) AddDetail(d *ErrorDetail) + func (e *Error) Code() Code + func (e *Error) Details() []*ErrorDetail + func (e *Error) Error() string + func (e *Error) Message() string + func (e *Error) Meta() http.Header + func (e *Error) Unwrap() error + type ErrorDetail struct + func NewErrorDetail(msg proto.Message) (*ErrorDetail, error) + func (d *ErrorDetail) Bytes() []byte + func (d *ErrorDetail) Type() string + func (d *ErrorDetail) Value() (proto.Message, error) + type ErrorWriter struct + func NewErrorWriter(opts ...HandlerOption) *ErrorWriter + func (w *ErrorWriter) IsSupported(request *http.Request) bool + func (w *ErrorWriter) Write(response http.ResponseWriter, request *http.Request, err error) error + type ExpectedCodecNameOption struct + ExpectedCodecName string + type HTTPClient interface + Do func(*http.Request) (*http.Response, error) + type Handler struct + func NewBidiStreamHandler(procedure string, streamFunc func(context.Context, *BidiStream) error, ...) *Handler + func NewClientStreamHandler(procedure string, ...) *Handler + func NewCompatStreamHandler(procedure string, srv interface{}, typ StreamType, ...) *Handler + func NewCompatUnaryHandler(procedure string, method string, srv interface{}, unary MethodHandler, ...) *Handler + func NewServerStreamHandler(procedure string, reqInitFunc func() interface{}, ...) *Handler + func NewUnaryHandler(procedure string, reqInitFunc func() interface{}, ...) *Handler + func (h *Handler) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request) + type HandlerOption interface + func WithCompression(name string, newDecompressor func() Decompressor, ...) HandlerOption + func WithHandlerOptions(options ...HandlerOption) HandlerOption + func WithRecover(handle func(context.Context, Spec, http.Header, interface{}) error) HandlerOption + func WithRequireTripleProtocolHeader() HandlerOption + type IdempotencyLevel int + const IdempotencyIdempotent + const IdempotencyNoSideEffects + const IdempotencyUnknown + func (i IdempotencyLevel) String() string + type Interceptor interface + WrapStreamingClient func(StreamingClientFunc) StreamingClientFunc + WrapStreamingHandler func(StreamingHandlerFunc) StreamingHandlerFunc + WrapUnary func(UnaryFunc) UnaryFunc + WrapUnaryHandler func(UnaryHandlerFunc) UnaryHandlerFunc + type MethodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, ...) (interface{}, error) + type Option interface + func WithCodec(codec Codec) Option + func WithCompressMinBytes(min int) Option + func WithExpectedCodecName(ExpectedCodecName string) Option + func WithGroup(group string) Option + func WithIdempotency(idempotencyLevel IdempotencyLevel) Option + func WithInterceptors(interceptors ...Interceptor) Option + func WithOptions(options ...Option) Option + func WithReadMaxBytes(max int) Option + func WithSendMaxBytes(max int) Option + func WithVersion(version string) Option + type Peer struct + Addr string + Protocol string + Query url.Values + type Request struct + Msg interface{} + func NewRequest(message interface{}) *Request + func (r *Request) Any() interface{} + func (r *Request) Header() http.Header + func (r *Request) Peer() Peer + func (r *Request) Spec() Spec + type Response struct + Msg interface{} + func NewResponse(message interface{}) *Response + func (r *Response) Any() interface{} + func (r *Response) Header() http.Header + func (r *Response) Trailer() http.Header + type Server struct + func NewServer(addr string) *Server + func (s *Server) GracefulStop(ctx context.Context) error + func (s *Server) RegisterBidiStreamHandler(procedure string, stream func(context.Context, *BidiStream) error, ...) error + func (s *Server) RegisterClientStreamHandler(procedure string, ...) error + func (s *Server) RegisterCompatStreamHandler(procedure string, srv interface{}, typ StreamType, ...) error + func (s *Server) RegisterCompatUnaryHandler(procedure string, method string, srv interface{}, unary MethodHandler, ...) error + func (s *Server) RegisterServerStreamHandler(procedure string, reqInitFunc func() interface{}, ...) error + func (s *Server) RegisterUnaryHandler(procedure string, reqInitFunc func() interface{}, ...) error + func (s *Server) Run() error + func (s *Server) Stop() error + type ServerStream struct + func (s *ServerStream) Conn() StreamingHandlerConn + func (s *ServerStream) ResponseHeader() http.Header + func (s *ServerStream) ResponseTrailer() http.Header + func (s *ServerStream) Send(msg interface{}) error + type ServerStreamForClient struct + func (s *ServerStreamForClient) Close() error + func (s *ServerStreamForClient) Conn() (StreamingClientConn, error) + func (s *ServerStreamForClient) Err() error + func (s *ServerStreamForClient) Msg() interface{} + func (s *ServerStreamForClient) Receive(msg interface{}) bool + func (s *ServerStreamForClient) ResponseHeader() http.Header + func (s *ServerStreamForClient) ResponseTrailer() http.Header + type Spec struct + IdempotencyLevel IdempotencyLevel + IsClient bool + Procedure string + StreamType StreamType + type StreamType uint8 + const StreamTypeBidi + const StreamTypeClient + const StreamTypeServer + const StreamTypeUnary + type StreamingClientConn interface + CloseRequest func() error + CloseResponse func() error + Peer func() Peer + Receive func(interface{}) error + RequestHeader func() http.Header + ResponseHeader func() http.Header + ResponseTrailer func() http.Header + Send func(interface{}) error + Spec func() Spec + type StreamingClientFunc func(context.Context, Spec) StreamingClientConn + type StreamingHandlerConn interface + ExportableHeader func() http.Header + Peer func() Peer + Receive func(interface{}) error + RequestHeader func() http.Header + ResponseHeader func() http.Header + ResponseTrailer func() http.Header + Send func(interface{}) error + Spec func() Spec + type StreamingHandlerFunc func(context.Context, StreamingHandlerConn) error + type UnaryFunc func(context.Context, AnyRequest, AnyResponse) error + type UnaryHandlerFunc func(ctx context.Context, request AnyRequest) (AnyResponse, error) + type UnaryInterceptorFunc func(UnaryFunc) UnaryFunc + func (f UnaryInterceptorFunc) WrapStreamingClient(next StreamingClientFunc) StreamingClientFunc + func (f UnaryInterceptorFunc) WrapStreamingHandler(next StreamingHandlerFunc) StreamingHandlerFunc + func (f UnaryInterceptorFunc) WrapUnary(next UnaryFunc) UnaryFunc + func (f UnaryInterceptorFunc) WrapUnaryHandler(next UnaryHandlerFunc) UnaryHandlerFunc