Documentation
¶
Overview ¶
Package parser exposes the koanf-style Parser slot used at the Manager call site (WithSource(file.New(path), yaml.Parser())).
A Parser is contracts.Codec plus a list of canonical content-types ("yaml", ".yaml", ".yml", "application/yaml"). The built-in yaml / json / toml parsers are registered in this package's init so that Bind can auto-select a parser from a Source.Read content-type hint when the caller passes nil.
Parsers are thin wrappers over pkg/decoder Codecs; the registry here is a content-type index on top of that flat map.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSON ¶
JSON returns the built-in JSON parser. It claims "json", ".json", "application/json", "text/json".
func Lookup ¶
Lookup returns the Parser registered for the given content-type, or (nil, false) if none matches. Lookup is case-insensitive and accepts both the bare extension ("yaml"), the dotted form (".yaml"), and the MIME type ("application/yaml"). The empty string is never a hit.
func New ¶
New constructs a Parser from an existing Codec plus the content-types this Parser claims. The content-types are stored case-folded; lookup is case-insensitive.
func Register ¶
Register installs p under every content-type it claims. Subsequent calls override prior registrations for the same content-type, which makes test helpers and feature toggles ergonomic.
Types ¶
This section is empty.