settings

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyGRPCSettings

func ApplyGRPCSettings(
	opts *grpcx.Options,
	settings map[string]string,
	resolver *vars.Resolver,
) error

func ApplyHTTPSettings

func ApplyHTTPSettings(
	opts *httpx.Options,
	settings map[string]string,
	resolver *vars.Resolver,
) error

func FromValues added in v0.49.1

func FromValues(values map[string]string) map[string]string

func IsHTTPKey added in v0.17.1

func IsHTTPKey(key string) bool

IsHTTPKey reports whether key is a supported HTTP setting key.

func Merge

func Merge(scopes ...map[string]string) map[string]string

Merge folds scopes together in precedence order and returns canonical keys, so later scopes override earlier ones regardless of how each one wrote the key. A key also replaces the other names of its option from earlier scopes, so two names of one option are left only when one scope wrote both, which ApplyAll rejects. Keys are visited in sorted order to keep two forms of the same key in one scope from resolving differently between runs.

func Patch added in v1.18.2

func Patch(base map[string]string, patch map[string]*string) map[string]string

Patch returns base with patch layered over it as one more Merge scope. A nil value removes its key and the other name of the same option from base. base itself is not modified.

Types

type Applier

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

func New

func New(handlers ...Handler) Applier

func (Applier) ApplyAll

func (a Applier) ApplyAll(settings map[string]string) (map[string]string, error)

ApplyAll applies each setting through the first handler that matches its key and returns the settings no handler matched. settings must come from Merge, so its keys are canonical and both names of one option are left only when one scope wrote both. That fails the request.

type ApplyFunc

type ApplyFunc func(key, val string) error

type Handler

type Handler struct {
	// Component labels errors about the keys Match accepts.
	Component diag.Component
	Match     Matcher
	Apply     ApplyFunc
}

func GRPCHandler

func GRPCHandler(opts *grpcx.Options, resolver *vars.Resolver) Handler

func HTTPHandler

func HTTPHandler(opts *httpx.Options, resolver *vars.Resolver) Handler

type Matcher

type Matcher func(string) bool

func PrefixMatcher

func PrefixMatcher(prefixes ...string) Matcher

type ResolverProvider

type ResolverProvider interface {
	Resolver() *vars.Resolver
}

Jump to

Keyboard shortcuts

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