Documentation
¶
Overview ¶
Package configdata holds the resolved configuration tier consumed by the value binder: scalar values and per-key map values keyed by bindable config keys. Package configengine populates Data while validating loaded files or documents, and package conga folds it into the tier cascade.
Index ¶
- Constants
- func JoinOriginScope(origin, scope string) string
- type Data
- func (data *Data) EnsureMap(keys []string) map[string]Value
- func (data *Data) HasKey(key string) bool
- func (data *Data) Map(key string) map[string]Value
- func (data *Data) ScalarValue(key string) (Value, bool)
- func (data *Data) SetScalar(key, raw, origin string)
- func (data *Data) SetScalarScoped(key, raw, origin, scope string)
- type Value
Constants ¶
const ScopeSeparator = " › "
ScopeSeparator separates an origin from its optional scope in rendered provenance.
Variables ¶
This section is empty.
Functions ¶
func JoinOriginScope ¶
JoinOriginScope joins an origin with its optional scope for display. An empty origin records no provenance detail and ignores the scope.
Types ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data holds the validated configuration tier of one invocation: scalar values and per-key map values, keyed by bindable config key. Later stores overwrite earlier ones in place as files or documents are read.
func (*Data) EnsureMap ¶
EnsureMap returns the shared per-key map for the given alias keys of a map flag, creating and binding it across all alias keys if not yet present. Calling EnsureMap with an empty map section still records the keys as present for HasKey checks.
func (*Data) HasKey ¶
HasKey reports whether key was set in the configuration tier (as a scalar or as a map section, even an empty one).
func (*Data) Map ¶
Map returns the merged per-key map stored under key, or nil when no map was recorded for key.
func (*Data) ScalarValue ¶
ScalarValue returns the scalar value and its origin stored under key. Consumers that need the provenance — such as the value binder and the programmatic configuration loader — prefer it over a raw-string accessor.
func (*Data) SetScalar ¶
SetScalar records a scalar value and its origin under key, overwriting any value stored by an earlier file.
func (*Data) SetScalarScoped ¶
SetScalarScoped records a scalar value, its origin, and an optional scope within that origin under key, overwriting any value stored by an earlier file. An empty origin records no scope.
type Value ¶
type Value struct {
// Raw is the stringified value.
Raw string
// Origin is the configuration file path that supplied the value;
// programmatic loaders may supply other source labels.
Origin string
// Scope names the region within Origin that supplied the value, such as a
// section of a configuration file. It is empty when Origin is a whole
// source or none was supplied.
Scope string
}
Value is a resolved configuration value and the origin that supplied it.
func (Value) SourceDetail ¶
SourceDetail renders the origin with its optional scope for value attribution.