Documentation
¶
Overview ¶
Package render formats melange.Trace values for terminal display.
The renderer is the shared presentation layer for both `melange explain` and `melange expand`. It walks a *melange.Trace and emits a unicode-tree- style summary suitable for human reading. JSON output is left to callers (encoding/json on the Trace value is sufficient — keys are already snake_case to match the SQL convention).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
func Expand(w io.Writer, t *melange.UsersetTree, options ...Option)
Expand writes a human-readable rendering of an OpenFGA-shaped UsersetTree to w. A nil tree prints nothing; an empty Root prints just a "(no nodes)" placeholder so the output is never silent on a successfully-deserialised but degenerate response.
Output shape mirrors the Explain renderer's tree style but using OpenFGA's terminology: each node prints its name followed by either the leaf payload (users / computed pointer / TTU pointer) or the union/intersection/difference structure with children.
func ExpandString ¶
func ExpandString(t *melange.UsersetTree, options ...Option) string
ExpandString renders an UsersetTree into a string. Convenience wrapper around Expand for tests, log lines, and HTTP responses.
func Trace ¶
Trace writes a human-readable rendering of t to w. A nil trace prints nothing; an empty Root prints just the header line.
The output shape:
<header>
└── <root node>
├── <child>
└── <child>
└── <grandchild>
<truncation footer if any>
Explain headers include the subject and a ✓/✗ result marker. Expand headers carry only "<relation> on <object>" because the answer is the full tree, not a single boolean.