debian-forge-composer/vendor/github.com/dprotaso/go-yit
Sanne Raymaekers b2700903ae go.mod: bump github.com/getkin/kin-openapi to v0.131.0
As deepmap/oapi-codegen didn't work with this newer version, upgrade to
oapi-codegen/oapi-codegen v2.

Mitigating CVE-2025-30153
2025-03-26 11:13:14 +01:00
..
.gitignore go.mod: bump github.com/getkin/kin-openapi to v0.131.0 2025-03-26 11:13:14 +01:00
aggregates.go go.mod: bump github.com/getkin/kin-openapi to v0.131.0 2025-03-26 11:13:14 +01:00
iterator.go go.mod: bump github.com/getkin/kin-openapi to v0.131.0 2025-03-26 11:13:14 +01:00
LICENSE go.mod: bump github.com/getkin/kin-openapi to v0.131.0 2025-03-26 11:13:14 +01:00
predicates.go go.mod: bump github.com/getkin/kin-openapi to v0.131.0 2025-03-26 11:13:14 +01:00
README.md go.mod: bump github.com/getkin/kin-openapi to v0.131.0 2025-03-26 11:13:14 +01:00

go-yit - YAML Iterator

GoDoc

Introduction

This library compliments go-yaml v3 by adding functional style methods for iterating over YAML documents.

Usage

Import the package

import "github.com/dprotaso/go-yit"

Query your YAML document

package main

import (
	"fmt"
	"log"

	"github.com/dprotaso/go-yit"
	"gopkg.in/yaml.v3"
)

var data = `
a: b
c: d
e: f
`

func main() {
	var doc yaml.Node
	err := yaml.Unmarshal([]byte(data), &doc)

	if err != nil {
		log.Fatalf("error: %v", err)
	}

	it := yit.FromNode(&doc).
		RecurseNodes().
		Filter(yit.WithKind(yaml.MappingNode)).
		MapKeys()

	for node, ok := it(); ok; node, ok = it() {
		fmt.Println(node.Value)
	}
}