render

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package render 负责响应的格式化输出, 对照 ant 的 --format / --transform / --raw-output。

支持格式: auto, json, jsonl, yaml, pretty, raw, explore。 (explore 在本实现里等价于 pretty —— 不内嵌 TUI, 但语义保留: 人看的缩进输出。)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(w io.Writer, raw []byte, opts Options) error

Render 把原始响应 body 按 opts 输出到 w。

Types

type Options

type Options struct {
	Format    string // auto/json/jsonl/yaml/pretty/raw/explore
	Transform string // GJSON 路径, 空则不变换
	RawOutput bool   // 字符串结果去掉 JSON 引号 (jq -r 语义)
	// ListPath 非空时, 表示这是一个 list 端点, 对该路径下数组的每个元素逐个变换/输出,
	// 与 ant "transform 作用于每个 item 而非信封" 的行为一致。
	ListPath string
}

Options 控制一次渲染。

Jump to

Keyboard shortcuts

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