nacos

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NacosDefaultServerAddr   = "127.0.0.1"
	NacosDefaultPort         = 8848
	NacosDefaultConfigGroup  = "DEFAULT_GROUP"
	NacosDefaultClientDataID = "{{.ClientServiceName}}.{{.ServerServiceName}}.{{.Category}}"
	NacosDefaultServerDataID = "{{.ServerServiceName}}.{{.Category}}"
)

Variables

This section is empty.

Functions

func GetUniqueID added in v0.3.0

func GetUniqueID() int64

GetUniqueID get the unique id

func NewCustomNacosLogger

func NewCustomNacosLogger() logger.Logger

Types

type Client

type Client interface {
	SetParser(ConfigParser)
	ClientConfigParam(cpc *ConfigParamConfig) (vo.ConfigParam, error)
	ServerConfigParam(cpc *ConfigParamConfig) (vo.ConfigParam, error)
	RegisterConfigCallback(vo.ConfigParam, func(string, ConfigParser), int64)
	DeregisterConfig(vo.ConfigParam, int64) error
}

Client the wrapper of nacos client.

func NewClient added in v0.2.0

func NewClient(opts Options) (Client, error)

NewClient Create a default Nacos client

type ConfigParamConfig

type ConfigParamConfig struct {
	Category          string
	ClientServiceName string
	ServerServiceName string
}

ConfigParamConfig use for render the dataId or group info by go template, ref: https://pkg.go.dev/text/template The fixed key shows as below.

type ConfigParser

type ConfigParser interface {
	Decode(kind vo.ConfigType, data string, config interface{}) error
}

ConfigParser the parser for nacos config.

type CustomFunction

type CustomFunction func(*vo.ConfigParam)

CustomFunction use for customize the config parameters.

type Options

type Options struct {
	Address            string
	Port               uint64
	NamespaceID        string
	RegionID           string
	Group              string
	ServerDataIDFormat string
	ClientDataIDFormat string
	CustomLogger       logger.Logger
	Password           string
	Username           string
	ConfigParser       ConfigParser
}

Options nacos config options. All the fields have default value.

Jump to

Keyboard shortcuts

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