Help us shape the future of Go! Take the 2026 Go Developer Survey

valuesource

package
v0.260.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package valuesource is umbra's shared value-resolution layer: a Provider reads a named address at request time, so neither engine imports a store SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builtins

func Builtins() map[string]Provider

Builtins are the store-agnostic resolvers umbra ships itself: no SDK, no wiring. A consumer entry of the same name overrides one via Merge.

func Merge

func Merge(consumer map[string]Provider) map[string]Provider

Merge layers the consumer's registry over the built-ins (consumer wins on a clash), always non-nil. A missing provider fails closed in Resolve.

func Resolve

func Resolve(ctx context.Context, providers map[string]Provider, provider, address string) (string, error)

Resolve reads address through the named provider. A missing provider or a resolver error is returned for the caller to wrap; the value is never logged.

func ResolveFirst

func ResolveFirst(ctx context.Context, providers map[string]Provider, sources []Source) (string, error)

ResolveFirst returns the first source resolving to a non-empty value with no error, else a combined error naming each tried source - never a value.

Types

type Provider

type Provider func(ctx context.Context, address string) (string, error)

Provider resolves the value at address for one named value source. A consumer registers store-backed resolvers; the same func type drives both engines.

type Source

type Source struct {
	Provider string
	Address  string
}

Source is one (provider, address) pair: where a value is read and the address the provider interprets. An ordered slice of these is a fallback chain.

Jump to

Keyboard shortcuts

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