Versions in this module Expand all Collapse all v0 v0.1.0 Dec 22, 2023 Changes in this version + const KindBool + const KindCustom + const KindDuration + const KindInt + const KindInvalid + const KindSettings + const KindString + const KindUint + var ErrBlueprint = errors.New("settings blueprint") + var ErrProfile = fmt.Errorf("%w: profile", ErrSettings) + var ErrSchema = errors.New("schema") + var ErrSetting = errors.New("setting") + var ErrSettings = errors.New("settings") + var ErrSpec = errors.New("spec error") + type Blueprint struct + func New(s Settings) (*Blueprint, error) + func (b *Blueprint) AddSpec(spec SettingSpec) error + func (b *Blueprint) AddValidator(key, desc string, fn func(s Setting) error) + func (b *Blueprint) Describe(key string, lang language.Tag, description string) + func (b *Blueprint) Extend(group string, ext Settings) + func (b *Blueprint) GetSpec(key string) (SettingSpec, error) + func (b *Blueprint) Schema(module, version string) (Schema, error) + type Bool bool + func (b *Bool) UnmarshalSetting(data []byte) error + func (b Bool) MarshalSetting() ([]byte, error) + func (b Bool) SettingKind() Kind + func (b Bool) String() string + type Duration time.Duration + func (d *Duration) UnmarshalSetting(data []byte) error + func (d Duration) MarshalSetting() ([]byte, error) + func (d Duration) SettingKind() Kind + func (d Duration) String() string + type ExecutionMode int + const ModeDevel + const ModeProduction + const ModeTesting + const ModeUnknown + func (e *ExecutionMode) UnmarshalText(data []byte) error + func (e ExecutionMode) MarshalText() ([]byte, error) + func (e ExecutionMode) String() string + type Int int + func (i *Int) UnmarshalSetting(data []byte) error + func (i Int) MarshalSetting() ([]byte, error) + func (i Int) SettingKind() Kind + func (i Int) String() string + type Kind uint8 + func (k Kind) String() string + type Marshaller interface + MarshalSetting func() ([]byte, error) + type Mutability uint8 + const SettingImmutable + const SettingMutable + const SettingOnce + type Preferences struct + func NewPreferences() *Preferences + func (p *Preferences) Consume() + func (p *Preferences) Set(key, val string) + type Profile struct + func (p *Profile) All() []Setting + func (p *Profile) Get(key string) Setting + func (p *Profile) Has(key string) bool + func (p *Profile) Lang() language.Tag + func (p *Profile) Loaded() bool + func (p *Profile) Module() string + func (p *Profile) Name() string + func (p *Profile) Pkg() string + func (p *Profile) Set(key string, val SettingField) (err error) + func (p *Profile) Version() string + type Schema struct + func (s *Schema) Profile(name string, p *Preferences) (*Profile, error) + type Setting struct + func (s Setting) IsSet() bool + func (s Setting) Key() string + func (s Setting) Kind() Kind + func (s Setting) String() string + func (s Setting) Value() vars.Variable + type SettingField interface + SettingKind func() Kind + type SettingSpec struct + Default string + IsSet bool + Key string + Kind Kind + Marchaler Marshaller + Mutability Mutability + Required bool + Settings *Blueprint + Unmarchaler Unmarshaller + Value string + func ParseToSpec(s Settings) ([]SettingSpec, error) + func (s SettingSpec) Validate() error + type Settings interface + Blueprint func() (*Blueprint, error) + type String string + func (s *String) UnmarshalSetting(data []byte) error + func (s String) MarshalSetting() ([]byte, error) + func (s String) SettingKind() Kind + func (s String) String() string + type Uint uint + func (u *Uint) UnmarshalSetting(data []byte) error + func (u Uint) MarshalSetting() ([]byte, error) + func (u Uint) SettingKind() Kind + func (u Uint) String() string + type Unmarshaller interface + UnmarshalSetting func([]byte) error