webcenter

package
v1.0.2-dev-10 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MulanPSL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const WebClient_Timeout = 20 * time.Second

@Title 文件名称: ichub_web_client.go @Description 描述: WEB客户端服务发现,支持多个服务

@Author 作者: leijianming@163.com 时间(2024-02-18 22:38:21) @Update 作者: leijianming@163.com 时间(2024-02-18 22:38:21)

Variables

This section is empty.

Functions

func InjectWebCenter

func InjectWebCenter(s *WebCenter)

func InjectWebClient

func InjectWebClient(s *WebClient)

func LoadWebCenter

func LoadWebCenter() baseiface.ISingleton

func LoadWebClient

func LoadWebClient() baseiface.ISingleton

Types

type WebCenter

type WebCenter struct {
	basedto.BaseEntitySingle
	// contains filtered or unexported fields
}

不使用注册中心

func FindBeanWebCenter

func FindBeanWebCenter() *WebCenter

func NewWebCenter

func NewWebCenter() *WebCenter

func (*WebCenter) FindService

func (self *WebCenter) FindService(serviceName string) *basedto.IchubResult

func (*WebCenter) Register

func (self *WebCenter) Register(info *webdto.CenterInfo) *basedto.IchubResult

func (*WebCenter) Unregister

func (self *WebCenter) Unregister(info *webdto.CenterInfo) *basedto.IchubResult

type WebClient

type WebClient struct {
	basedto.BaseEntity

	// 可测试性 baseurl -> http://xxx.xxx.xxx.xxx:xx
	TestUrl string `json:"testUrl"`
	BaseUrl string `json:"baseUrl"`
	//服务名称
	ServerName string `json:"serverName"`
	// etcd注册服务器地址  xxx.xxx.xxx.xxx:xx
	EtcdHosts []string `json:"etcdHosts"`

	Registry   registry.Registry        `json:"-"`
	Config     *ichubconfig.IchubConfig `json:"-"`
	WebTimeout time.Duration            `json:"webTimeout"`
}

func Default

func Default() *WebClient

func FindBeanWebClient

func FindBeanWebClient() *WebClient

func New

func New(clientDto *baseconfig.WebClientDto) *WebClient

func NewBy

func NewBy(etcdhost, serviceName string) *WebClient

func NewByServiceName

func NewByServiceName(serviceName string) *WebClient

func NewWebClient

func NewWebClient(cfgFile string) *WebClient

func (*WebClient) BindBody

func (this *WebClient) BindBody(ctx *gin.Context) ([]byte, error)

func (*WebClient) CheckServiceExists

func (this *WebClient) CheckServiceExists(ServerName string, checkTimes int) (address string)

func (*WebClient) Delete

func (this *WebClient) Delete(url string) *basedto.IchubResult

func (*WebClient) DeleteWeb

func (this *WebClient) DeleteWeb(msg *webmsg.WebMsg) (*resty.Response, error)

func (*WebClient) ExistServiceName

func (this *WebClient) ExistServiceName() bool

func (*WebClient) Get

func (this *WebClient) Get(url string) *basedto.IchubResult

func (*WebClient) Get2PageResult

func (this *WebClient) Get2PageResult(msg *webmsg.WebMsg) *page.PageResult

func (*WebClient) Get2Result

func (this *WebClient) Get2Result(msg *webmsg.WebMsg) *basedto.IchubResult

func (*WebClient) GetServiceAddr

func (this *WebClient) GetServiceAddr() (address string)

func (*WebClient) GetServiceAddrBy

func (this *WebClient) GetServiceAddrBy(ServerName string) (address string)

func (*WebClient) GetServiceAddrs

func (this *WebClient) GetServiceAddrs() []*registry.Service

func (*WebClient) GetServiceAll

func (this *WebClient) GetServiceAll(serverName string) []*registry.Service

func (*WebClient) GetWeb

func (this *WebClient) GetWeb(msg *webmsg.WebMsg) (*resty.Response, error)

func (*WebClient) IfServiceExists

func (this *WebClient) IfServiceExists() bool

func (*WebClient) IfTestUrl

func (this *WebClient) IfTestUrl() bool

func (*WebClient) Init

func (this *WebClient) Init() *WebClient

func (*WebClient) Post

func (this *WebClient) Post(body, url string) *basedto.IchubResult

func (*WebClient) Post2PageResult

func (this *WebClient) Post2PageResult(msg *webmsg.WebMsg) *page.PageResult

func (*WebClient) Post2Result

func (this *WebClient) Post2Result(msg *webmsg.WebMsg) *basedto.IchubResult

func (*WebClient) PostBatch

func (this *WebClient) PostBatch(body, url string) *basedto.IchubResults

func (*WebClient) PostProxy

func (this *WebClient) PostProxy(msg *webmsg.WebMsg, proxy baseiface.IbaseProxy) *basedto.IchubResult

func (*WebClient) PostWeb

func (this *WebClient) PostWeb(msg *webmsg.WebMsg) (*resty.Response, error)

func (*WebClient) Put

func (this *WebClient) Put(body []byte, url string) *basedto.IchubResult

func (*WebClient) PutWeb

func (this *WebClient) PutWeb(msg *webmsg.WebMsg) (*resty.Response, error)

func (*WebClient) ReadCfg

func (this *WebClient) ReadCfg()

func (*WebClient) RefreshAddr

func (this *WebClient) RefreshAddr()

func (*WebClient) Resp2IchubResult

func (this *WebClient) Resp2IchubResult(resp *resty.Response, err error) *basedto.IchubResult

func (*WebClient) Resp2IchubResults

func (this *WebClient) Resp2IchubResults(resp *resty.Response, err error) *basedto.IchubResults

func (*WebClient) Resp2PageResult

func (this *WebClient) Resp2PageResult(resp *resty.Response, err error) *page.PageResult

func (*WebClient) SetBaseUrl

func (this *WebClient) SetBaseUrl(baseUrl string) string

func (*WebClient) ValueOf

func (this *WebClient) ValueOf(clientDto *baseconfig.WebClientDto)

func (*WebClient) Web

func (this *WebClient) Web(msg *webmsg.WebMsg) (*resty.Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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