yaml

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ParserFormat string = "YAML"

ParserFormat defines the standard identifier and file extension target for this provider.

View Source
const XERR_PKGCTX_PARSER xerrors.ErrorCode = "XCONFIG.PARSER.YAML"

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

Parser implements the xconfig.Parser interface to read, parse, and merge data from structured YAML configuration files.

func NewParser

func NewParser() *Parser

NewParser instantiates an unconfigured pointer to a YAML Parser.

func (*Parser) Read

func (o *Parser) Read() (map[string]any, error)

Read processes all matched YAML configuration files, loads their byte content into memory, and unmarshals the content syntax into a single consolidated generic map workspace.

Key behaviors:

  • Loops through every identified path and aggregates properties into a shared map object.
  • Bypasses empty text streams securely using a continue directive to evaluate adjacent file configurations.
  • Note: The file scanner relies strictly on the "YAML" token extension layout. Ensure target files match this literal specification exactly (e.g., config.yaml).

Returns a merged generic map of configurations, or an error if any file read or decoding routine fails.

func (*Parser) SetOptions

func (o *Parser) SetOptions(opts xconfig.Options) error

SetOptions executes strict path validation against the incoming criteria. It configuration targets must satisfy single-path exclusivity (File vs Dir vs ConfigPath) ensuring unambiguous resolution of YAML files.

Jump to

Keyboard shortcuts

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