collections

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package collections manages YAML-based collection configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	Name        string            `yaml:"name"`
	Description string            `yaml:"description"`
	PathContext map[string]string `yaml:"path_context"`
}

Collection describes a named document namespace.

func (*Collection) ResolveContext

func (c *Collection) ResolveContext(path string) string

ResolveContext returns the concatenated context for a given path. Algorithm: for every prefix key in PathContext, if path has that prefix, collect it. Sort matched prefixes shortest-to-longest. Concatenate their values with "\n\n". Returns empty string if no matches.

type Config

type Config struct {
	Collections []Collection `yaml:"collections"`
}

Config is the top-level YAML structure.

type Registry

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

Registry holds loaded collections, keyed by name.

func Load

func Load(path string) (*Registry, error)

Load reads the YAML file at path and returns a Registry. If the file does not exist, Load returns an empty Registry (not an error).

func (*Registry) All

func (r *Registry) All() []*Collection

All returns all collections in definition order.

func (*Registry) Get

func (r *Registry) Get(name string) (*Collection, bool)

Get returns a collection by name. Returns (nil, false) if not found.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns a sorted list of collection names.

Jump to

Keyboard shortcuts

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