client

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2025 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMapValue

func GetMapValue(sourceMap map[string]any, keys []string) (any, error)

GetMapValue return the value from map base on the path

func ParseMapSource

func ParseMapSource(source string) (from string, params []string, err error)

ParseMapSource parses the source parameter config in the mappingParams the source parameter in config could be queryStrings.*, headers.*, requestBody.*

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

func NewReq

func NewReq(ctx context.Context, request *http.Request, api router.API) *Request

NewReq create a request

func (*Request) GetURL

func (r *Request) GetURL() string

GetURL new url

type RequestOption

type RequestOption interface {
	Action(target, val any) error
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL