Documentation ¶
Index ¶
- Constants
- type Dispatcher
- type DispatcherConfig
- type FiberCodec
- type Request
- func (r *Request) Clone() (fiber.Request, error)
- func (r *Request) Header() map[string][]string
- func (r *Request) OperationName() string
- func (r *Request) Payload() []byte
- func (r *Request) ProtoMessage() proto.Message
- func (r *Request) Protocol() protocol.Protocol
- func (r *Request) Transform(_ fiber.Backend) (fiber.Request, error)
- type Response
- func (r *Response) BackendName() string
- func (r *Response) IsSuccess() bool
- func (r *Response) Label(key string) []string
- func (r *Response) Payload() []byte
- func (r *Response) StatusCode() int
- func (r *Response) WithBackendName(backendName string) fiber.Response
- func (r *Response) WithLabel(key string, values ...string) fiber.Response
- func (r *Response) WithLabels(labels fiber.Labels) fiber.Response
Constants ¶
const ( TimeoutDefault = time.Second // Number of gRPC connection in a pool ConnPoolCount = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(config DispatcherConfig) (*Dispatcher, error)
NewDispatcher is the constructor to create a dispatcher. It will create the clientconn and set defaults. Endpoint, serviceMethod and response proto are required minimally to work.
type DispatcherConfig ¶
type FiberCodec ¶
type FiberCodec struct {
// contains filtered or unexported fields
}
FiberCodec is a custom codec to prevent marshaling and unmarshalling when unnecessary, base on the inputs
func NewFiberCodec ¶
func NewFiberCodec() *FiberCodec
func (*FiberCodec) Marshal ¶
func (fc *FiberCodec) Marshal(v interface{}) ([]byte, error)
Marshal will attempt to pass the request directly if it is a byte slice, otherwise unmarshal the request proto using the default implementation
func (*FiberCodec) Name ¶
func (*FiberCodec) Name() string
func (*FiberCodec) Unmarshal ¶
func (fc *FiberCodec) Unmarshal(data []byte, v interface{}) error
Unmarshal will attempt to write the request directly if it is a writer, otherwise unmarshal the request proto using the default implementation
type Request ¶
type Request struct { // Metadata will hold the grpc headers for request Metadata metadata.MD Message []byte Proto proto.Message }
func NewRequest ¶
func (*Request) OperationName ¶
OperationName is naming used in tracing interceptors
func (*Request) ProtoMessage ¶
type Response ¶
func (*Response) BackendName ¶
func (*Response) Label ¶
Label returns all the values associated with the given key, in the response metadata. If the key does not exist, an empty slice will be returned.
func (*Response) StatusCode ¶
func (*Response) WithBackendName ¶
WithBackendName sets the given backend name in the response metadata. The modified response is returned.