Documentation
¶
Overview ¶
Package gs_dync provides dynamic configuration binding and refresh capabilities for Go-Spring applications.
It allows application components to register themselves as refreshable objects that automatically update their internal state whenever the underlying configuration changes.
Key components:
- Properties: holds the current configuration and manages all registered `refreshable` objects.
- Value[T]: a type-safe container for dynamic configuration values.
- Listener: allows components to receive change notifications.
- `refreshable`: interface that application components can implement to react to configuration updates.
This package is designed to be thread-safe and suitable for hot-reload scenarios in long-running applications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Errors ¶
type Errors struct {
// contains filtered or unexported fields
}
Errors represents a collection of errors.
type Listener ¶
type Listener struct {
C chan struct{}
}
Listener holds a channel to receive notifications.
type Properties ¶
type Properties struct {
// contains filtered or unexported fields
}
Properties manages dynamic properties and refreshable objects.
func New ¶
func New(p conf.Properties) *Properties
New creates and returns a new Properties instance.
func (*Properties) Data ¶
func (p *Properties) Data() conf.Properties
Data returns the current properties.
func (*Properties) ObjectsCount ¶
func (p *Properties) ObjectsCount() int
ObjectsCount returns the number of registered refreshable objects.
func (*Properties) Refresh ¶
func (p *Properties) Refresh(prop conf.Properties) (err error)
Refresh updates the properties and refreshes all bound objects as necessary.
func (*Properties) RefreshField ¶
RefreshField refreshes a field of a bean, optionally registering it as refreshable.
type Value ¶
type Value[T any] struct { // contains filtered or unexported fields }
Value represents a thread-safe object that can dynamically refresh its value.
func (*Value[T]) MarshalJSON ¶
MarshalJSON serializes the stored value as JSON.
func (*Value) NewListener ¶
func (r *Value) NewListener() *Listener
NewListener creates and registers a new listener.