settingstest

package
v0.30.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 1 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

Overview

Package settingstest serves settings sections from memory for tests. Source satisfies app/settings.Reader and app/settingswatch.Source without importing either, so tests inside app/settings can use it too. It does not decode or validate: a test stores the typed value a consumer expects to read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

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

Source holds the sections a test stores and the change callbacks consumers register per section. The zero value is empty and ready to use.

func Sections

func Sections(values map[string]any) *Source

Sections returns a Source holding values, keyed by section name.

func (*Source) Callbacks

func (s *Source) Callbacks(section string) int

Callbacks reports how many change callbacks are registered for section.

func (*Source) Change

func (s *Source) Change(section string, v any)

Change stores v under section, then runs the section's callbacks outside the lock, the order the catalog's settings listener keeps: the new value is readable before any callback runs.

func (*Source) Delete

func (s *Source) Delete(section string)

Delete removes section, so it reads as absent.

func (*Source) OnSettingsChange

func (s *Source) OnSettingsChange(section string, fn func())

func (*Source) Set

func (s *Source) Set(section string, v any)

Set stores v under section without running its callbacks.

func (*Source) Setting

func (s *Source) Setting(section string) (any, bool)

Jump to

Keyboard shortcuts

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