nacos

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

go-zero 整合 nacos 配置中心和注册中心

deprecated-使用K8SDNS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalObjectToYamlString

func MarshalObjectToYamlString(obj interface{}) (string, error)

MarshalObjectToYamlString 序列化对象为 yaml 字符串

func MergeMap

func MergeMap(dest, src map[interface{}]interface{}) map[interface{}]interface{}

MergeMap 合并源 map 到目标 map

func RegisterRESTful

func RegisterRESTful(nacosConfig *Nacos, serverConf *rest.RestConf)

RegisterRESTful 注册RESTful API

func RegisterRPC

func RegisterRPC(nacosConfig *Nacos, serverConf *zrpc.RpcServerConf)

RegisterRPC 注册

func UnmarshalYamlToMap

func UnmarshalYamlToMap(yamlStr string) (map[interface{}]interface{}, error)

UnmarshalYamlToMap 反序列化 yaml 为 map[interface{}]interface{}

Types

type Nacos

type Nacos struct {
	Addr        string
	Port        uint64
	GrpcPort    uint64
	Group       string
	DataID      string
	NamespaceID string
	Username    string
	Password    string
	ExtDataIDs  []string `json:",optional"`
}

Nacos 配置文件

func MustLoad

func MustLoad(nacosConfigFilePath string, v interface{}) *Nacos

MustLoad 配置获取

func (*Nacos) GetConfig

func (conf *Nacos) GetConfig() (string, error)

GetConfig 获取配置文件

func (*Nacos) InitConfigClient

func (conf *Nacos) InitConfigClient() (err error)

InitConfigClient 初始化客户端

func (*Nacos) Listen

func (conf *Nacos) Listen(onChange func(string, string, string, string)) error

Listen 监听

func (*Nacos) NewZrpcClient

func (conf *Nacos) NewZrpcClient(serverName, clientName string) zrpc.Client

NewZrpcClient RPC client

Directories

Path Synopsis
Created by guoxin in 2023/12/8 14:00
Created by guoxin in 2023/12/8 14:00

Jump to

Keyboard shortcuts

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