data

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package data provides JSON and YAML data loading functionality.

Package data provides JSON and YAML data loading functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(path string) (any, error)

Load reads data from a file and returns it as a generic interface. It automatically detects the format based on file extension.

func LoadReader

func LoadReader(r io.Reader, format string) (any, error)

LoadReader reads data from a reader in the specified format.

func Parse

func Parse(content []byte, format string) (any, error)

Parse parses data from bytes in the specified format.

func Query

func Query(data any, expression string) (any, error)

Query executes a jq expression against data and returns the first result. This is useful for transforming data (e.g., extracting a nested object).

func QueryAll

func QueryAll(data any, expression string) ([]any, error)

QueryAll executes a jq expression against data and collects all results. This is useful for extracting multiple items from data (e.g., ".items[]").

Types

This section is empty.

Jump to

Keyboard shortcuts

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