settings

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package settings provides shared helpers for coercing rule-configuration values decoded from YAML/CUE into Go types.

Rule packages receive untyped settings maps (e.g. from `.mdsmith.yml` overrides). YAML numbers may decode as int, float64, or int64 depending on source; YAML sequences decode as []any. These helpers give every rule one coercion implementation with consistent behavior and a single set of tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToFloat

func ToFloat(v any) (float64, bool)

ToFloat coerces v to a float64 when v is float64, int, or int64. NaN and +/-Inf are rejected. Other types are rejected.

func ToInt

func ToInt(v any) (int, bool)

ToInt coerces v to an int when v is int, int64, or float64. Float inputs are truncated toward zero. NaN, +/-Inf, and float values outside the int range are rejected (ok=false).

func ToStringSlice

func ToStringSlice(v any) ([]string, bool)

ToStringSlice coerces v to a []string when v is []string or a []any containing only strings. The returned slice is always a fresh copy so callers can mutate it without affecting the input. Other types (including strings) are rejected.

Types

This section is empty.

Jump to

Keyboard shortcuts

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