etcdclient

package
v0.0.0-...-457ba4f Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 7 Imported by: 0

README

etcdclient

和框架配套, 做服务管理功能用

如查询在线网关、node列表等功能,修改node权重值

Documentation

Overview

* User: cr-mao Date: 2023/9/5 18:28 Email: crmao@qq.com Desc: etcd.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(ins *registry.ServiceInstance) (string, error)

Types

type EtcdClient

type EtcdClient struct {
	// contains filtered or unexported fields
}
var GlobalEtcdClient *EtcdClient

func NewEtcdClient

func NewEtcdClient(addrs []string, dialTimeout time.Duration) *EtcdClient

内网不需要账号,密码

func (*EtcdClient) GetByKey

func (c *EtcdClient) GetByKey(ctx context.Context, key string) (*registry.ServiceInstance, error)

func (*EtcdClient) GetServerInstances

func (c *EtcdClient) GetServerInstances(ctx context.Context, namespace, serviceName string) (res []*registry.ServiceInstance, err error)

func (*EtcdClient) Pub

func (c *EtcdClient) Pub(ctx context.Context, key string, value string) error

Jump to

Keyboard shortcuts

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