nacos

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package nacos contains nacos config service utility.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	ServerAddress   string `yaml:"server_address" json:"server_address"`
	Timeout         int    `yaml:"timeout" json:"timeout"`
	Port            int    `yaml:"port" json:"port"`
	DataID          string `yaml:"data_id" json:"data_id"`
	ContextPath     string `yaml:"context_path" json:"context_path"`
	Group           string `yaml:"group" json:"group"`
	Namespace       string `yaml:"namespace" json:"namespace"`
	Scheme          string `yaml:"scheme" json:"scheme"`
	Username        string `yaml:"username" json:"username"`
	Password        string `yaml:"password" json:"password"`
	Languages       []Data `yaml:"languages" json:"languages"`
	DefaultLanguage string `yaml:"default_language" json:"default_language"`
}

Configuration contains nacos configuration structure

func (Configuration) DefaultLang

func (c Configuration) DefaultLang() string

DefaultLang returns default language setting.

type Data

type Data struct {
	Group string `yaml:"group" json:"group"`
	ID    string `yaml:"id" json:"id"`
}

Data contains a configuration data identifier.

type Watcher

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

Watcher contains definition to watch remote configuration changes

func NewWatcher

func NewWatcher(config Configuration) (*Watcher, error)

NewWatcher is the constructor to create Watcher instances.

func (*Watcher) Get

func (w *Watcher) Get(id string, group string, output any) error

Get should be used to get specific configuration from nacos server.

func (*Watcher) SetupInternational

func (w *Watcher) SetupInternational(c Configuration)

SetupInternational is used to prepare i18n support.

func (*Watcher) Watch

func (w *Watcher) Watch(id string, group string, action func(ns, group, id, cfg string)) error

Watch should be used to watch a configuration changes.

Jump to

Keyboard shortcuts

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