Document and benchmark sibling inheritance
This commit is contained in:
20
examples/consumers/inheritance.go
Normal file
20
examples/consumers/inheritance.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package consumers
|
||||
|
||||
import configkit "gitea.maximumdirect.net/eric/ConfigKit"
|
||||
|
||||
// PresetCatalog is ordinary application data; no inheritance fields or
|
||||
// registration hooks are required in the typed configuration.
|
||||
type PresetCatalog struct {
|
||||
Presets map[string]Preset `yaml:"presets"`
|
||||
}
|
||||
|
||||
type Preset struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
Settings map[string]map[string]int `yaml:"settings"`
|
||||
}
|
||||
|
||||
// LoadPresets performs one load; callers may inspect inherited presence and
|
||||
// source origins on the returned result before choosing a preset to execute.
|
||||
func LoadPresets(source configkit.Source) (*configkit.Result[PresetCatalog], error) {
|
||||
return configkit.Load[PresetCatalog](source)
|
||||
}
|
||||
Reference in New Issue
Block a user