data

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package data handles loading external data files (JSON/YAML/TOML) for templates. Supports data/ directory structure for organizing structured content.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetValue

func GetValue(data map[string]any, path string) (any, error)

GetValue retrieves a value from nested data using dot notation. Example: GetValue(data, "team.members") returns data["team"]["members"]

func LoadDataFiles

func LoadDataFiles(dataDir string) (map[string]any, error)

LoadDataFiles is a convenience function to load data from a directory.

Types

type Loader

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

Loader handles loading data files from the data directory.

func NewLoader

func NewLoader(dataDir string) *Loader

NewLoader creates a new data loader for the specified directory.

func (*Loader) Load

func (l *Loader) Load() (map[string]any, error)

Load reads all data files from the data directory and returns them as a map. Supports JSON (.json), YAML (.yaml, .yml), and TOML (.toml) formats. File names become keys in the returned map (without extension). Nested directories create nested maps.

Jump to

Keyboard shortcuts

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