Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterUnmarshaler ¶
RegisterUnmarshaler registers an unmarshaler.
Types ¶
type Config ¶
type Config struct { // Type is the value type, yaml, json or toml. Type string `json:",default=yaml,options=[yaml,json,toml]"` // Log is the flag to control logging. Log bool `json:",default=true"` }
Config is the configuration for Configurator.
type Configurator ¶
type Configurator[T any] interface { // GetConfig returns the subscription value. GetConfig() (T, error) // AddListener adds a listener to the subscriber. AddListener(listener func()) }
Configurator is the interface for configuration center.
func MustNewConfigCenter ¶
func MustNewConfigCenter[T any](c Config, subscriber subscriber.Subscriber) Configurator[T]
MustNewConfigCenter returns a Configurator, exits on errors.
func NewConfigCenter ¶
func NewConfigCenter[T any](c Config, subscriber subscriber.Subscriber) (Configurator[T], error)
NewConfigCenter returns a Configurator.
Click to show internal directories.
Click to hide internal directories.