Documentation
¶
Overview ¶
Package examples renders the runnable query examples in examples.yaml into a Markdown doc's marked example blocks (connectors.md), and is the basis for verifying (examples-check) and running (examples-test) those queries. examples.yaml is the single source of truth; the blocks between <!-- BEGIN/END EXAMPLES <name> --> markers are generated from it. See tools/examples for the CLI that drives this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply replaces each group's marker region in the doc with its rendered block and returns the updated doc. It errors if a group's markers are missing, so a renamed/typo'd marker fails loudly instead of silently dropping examples.
func RenderBlock ¶
RenderBlock renders a group's fenced ```sh example block (without the markers).
Types ¶
type Example ¶
type Example struct {
Desc string `yaml:"desc"`
Query string `yaml:"query"`
// Run is whether examples-test should execute this query; nil means true.
// Set false for queries that can't run as-is (e.g. a placeholder value).
Run *bool `yaml:"run"`
}
Example is one documented query.
type Group ¶
type Group struct {
Name string `yaml:"name"`
// Requires names a prerequisite for running the group's queries in
// examples-test ("jaeger" → a reachable local Jaeger); empty means none.
Requires string `yaml:"requires"`
Examples []Example `yaml:"examples"`
}
Group is a set of examples that maps to one README marker region.