miss_service

package
v0.0.0-...-b6b7464 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 21 Imported by: 0

README

由来

通过hz client生成的

作用

生成访问hertz 服务接口的client

注意事项

重新执行了hz client
  1. 需要复制hertz_client.go1中func newClient(etcd_enpoint string, opts *Options) (*cli, error)的代码到hertz_client.go中func newClient(etcd_enpoint string, opts *Options) (*cli, error) 方法的对应位置
  2. 需要复制miss_service.go中func NewMissServiceClient(hostUrl string, etcdEndpoint string, ops ...Option) (Client, error)代码覆盖miss_service.go中对应方法
  3. 需要复制main.go1中func main()的代码到main.go中func main() 方法的对应位置

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDefaultClient

func ConfigDefaultClient(ops ...Option) (err error)

func Miss

func Miss(context context.Context, req *miss.MissReq, reqOpt ...config.RequestOption) (resp *miss.MissResp, rawResponse *protocol.Response, err error)

Types

type Client

type Client interface {
	Miss(context context.Context, req *miss.MissReq, reqOpt ...config.RequestOption) (resp *miss.MissResp, rawResponse *protocol.Response, err error)
}

func NewMissServiceClient

func NewMissServiceClient(hostUrl string, etcdEndpoint string, ops ...Option) (Client, error)

type MissServiceClient

type MissServiceClient struct {
	// contains filtered or unexported fields
}

func (*MissServiceClient) Miss

func (s *MissServiceClient) Miss(context context.Context, req *miss.MissReq, reqOpt ...config.RequestOption) (resp *miss.MissResp, rawResponse *protocol.Response, err error)

type Option

type Option struct {
	// contains filtered or unexported fields
}

Configuration of client

func WithHeader

func WithHeader(header http.Header) Option

WithHeader is used to add the default header, which is carried by every request

func WithHertzClient

func WithHertzClient(client client.Doer) Option

WithHertzClient is used to register a custom hertz client

func WithHertzClientMiddleware

func WithHertzClientMiddleware(mws ...hertz_client.Middleware) Option

WithHertzClientMiddleware is used to register the middleware for the hertz client

func WithHertzClientOption

func WithHertzClientOption(opt ...config.ClientOption) Option

WithHertzClientOption is used to pass configuration for the hertz client

func WithResponseResultDecider

func WithResponseResultDecider(decider ResponseResultDecider) Option

WithResponseResultDecider configure custom deserialization of http response to response struct

type Options

type Options struct {
	// contains filtered or unexported fields
}

type ResponseResultDecider

type ResponseResultDecider func(statusCode int, rawResponse *protocol.Response) (isError bool)

Definition of global data and types.

Jump to

Keyboard shortcuts

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