apollo

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigCenter = &Apollo{}

Functions

This section is empty.

Types

type Apollo

type Apollo struct {
	Conf   Config
	Client agollo.Client
}

func (*Apollo) Close

func (cc *Apollo) Close() error

Close is a no-op; the Apollo client does not require explicit shutdown.

func (*Apollo) Config

func (cc *Apollo) Config() any

Config returns the embedded Conf as the configuration for injection.

func (*Apollo) Handle

func (e *Apollo) Handle(ctx context.Context, merge func(io.Reader) error, onChange func(io.Reader) error) error

Handle starts the Apollo client, merges all configured namespaces, and registers a change listener. TODO: improve change-listener update handling.

func (*Apollo) Type

func (e *Apollo) Type() string

Type returns the identifier string "apollo" for this config center.

type Config added in v0.13.10

type Config struct {
	config.AppConfig
	Namespaces []string
}

type CustomListener added in v0.13.10

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

1. 定义你的监听器结构体

func (*CustomListener) OnChange added in v0.13.10

func (l *CustomListener) OnChange(event *storage.ChangeEvent)

OnChange is called when any Apollo config key changes; it serializes the changes as properties and passes them to the registered onChange handler.

func (*CustomListener) OnNewestChange added in v0.13.10

func (l *CustomListener) OnNewestChange(event *storage.FullChangeEvent)

OnNewestChange is called with the full diff; currently a no-op.

Jump to

Keyboard shortcuts

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