Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMapValue ¶
GetMapValue return the value from map base on the path
Types ¶
type Client ¶
type Client interface {
// Apply to init client
Apply() error
// Close close the client
Close() error
// Call invoke the downstream service.
Call(req *Request) (res any, err error)
// MapParams mapping param, uri, query, body ...
MapParams(req *Request) (reqData any, err error)
}
Client represents the interface of http/dubbo clients
type DubboMetadata ¶
type DubboMetadata struct {
ApplicationName string `yaml:"application_name" json:"application_name" mapstructure:"application_name"`
Group string `yaml:"group" json:"group" mapstructure:"group"`
Version string `yaml:"version" json:"version" mapstructure:"version"`
Interface string `yaml:"interface" json:"interface" mapstructure:"interface"`
Method string `yaml:"method" json:"method" mapstructure:"method"`
Types []string `yaml:"types" json:"types" mapstructure:"types"`
Retries string `yaml:"retries" json:"retries,omitempty" property:"retries"`
ClusterName string `yaml:"cluster_name" json:"cluster_name,omitempty" property:"cluster_name"`
ProtocolTypeStr string `yaml:"protocol_type" json:"protocol_type,omitempty" property:"protocol_type"`
SerializationTypeStr string `yaml:"serialization_type" json:"serialization_type,omitempty" property:"serialization_type"`
}
DubboMetadata dubbo metadata, api config
type MapOption ¶
type MapOption map[string]RequestOption
MapOption option map, key : name, value : option
type ParamMapper ¶
type ParamMapper interface {
// Map implements how the request parameters map to the target parameters described by config.MappingParam
Map(config.MappingParam, *Request, any, RequestOption) error
}
ParamMapper defines the interface about how to map the params in the inbound request.
type Request ¶
type Request struct {
Context context.Context
IngressRequest *http.Request
API router.API
Timeout time.Duration
}
Request request for endpoint
type RequestOption ¶
RequestOption option interface.
type StreamResponse ¶ added in v1.1.0
type StreamResponse struct {
Stream io.ReadCloser
IsSSEStream bool
}
StreamResponse response from endpoint
func NewStreamResponse ¶ added in v1.1.0
func NewStreamResponse(stream io.ReadCloser, isSSE bool) *StreamResponse
NewStreamResponse create response contains a stream
func (*StreamResponse) IsSSE ¶ added in v1.1.0
func (r *StreamResponse) IsSSE() bool
type UnaryResponse ¶ added in v1.1.0
type UnaryResponse struct {
Data []byte
}
UnaryResponse response from endpoint
func NewUnaryResponse ¶ added in v1.1.0
func NewUnaryResponse(data []byte) *UnaryResponse
NewUnaryResponse create response contains a []byte
Click to show internal directories.
Click to hide internal directories.