constant

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package constant owns immutable, application-supplied constant values. It never reads request values or changes authored metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

type Loader struct{ FS afs.Service }

Loader reads one flat YAML/JSON scalar mapping. Multiple-file merging is not supported. JSON numbers never pass through float64.

func (Loader) Load

func (l Loader) Load(ctx context.Context, location string) (*Values, error)

type Values

type Values struct {
	// contains filtered or unexported fields
}

Values is a frozen, case-insensitive set. Constructors copy all caller maps. Values are strings to retain the existing typed-constant conversion boundary and preserve integer precision when loading JSON or YAML numbers.

func New

func New(values map[string]string) (*Values, error)

func (*Values) Apply

func (v *Values) Apply(component *spec.Component) *spec.Component

Apply returns runtime-only metadata with externally overridden const values. Call this after authored duplicate/conflict checks and never before generation.

func (*Values) Empty

func (v *Values) Empty() bool

func (*Values) For

func (v *Values) For(component *spec.Component) (*Values, error)

For overlays these instance values on validated authored defaults. Missing instance keys retain defaults; an empty value is an explicit override.

func (*Values) Identity

func (v *Values) Identity() string

Identity partitions native cache namespaces without exposing configured values.

func (*Values) Lookup

func (v *Values) Lookup(name string) (string, bool)

func (*Values) Names

func (v *Values) Names() []string

Names returns a sorted detached list of canonical names.

func (*Values) Path

func (v *Values) Path(source string) (string, error)

Path expands only exact constant tokens in a trusted path/URL argument. It is single-pass: dollar signs inside values never become further tokens.

func (*Values) Resources

func (v *Values) Resources(source fs.FS) fs.FS

Resources resolves a path at Open while retaining the supplied filesystem's namespace and root authority. It neither caches contents nor rewrites files.

func (*Values) Validate

func (v *Values) Validate(component *spec.Component, lookup func(string) (reflect.Type, error)) error

Validate checks external values with the same native conversion used by Bindly's const provider, before any discovery/connection work. Authored declaration consistency is deliberately left to the DQL compiler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL