Help us shape the future of Go! Take the 2026 Go Developer Survey

transformers

package
v1.16.8 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package transformers contains SDK-owned response transformations. Presentation, output formats, and terminal sanitization belong to pkg/custom.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identity

func Identity(_ context.Context, value gjson.Result) (gjson.Result, error)

Identity preserves the original response, including its raw JSON bytes.

Types

type OutputKind

type OutputKind string

OutputKind identifies the successful-response boundary being presented.

const (
	OutputUnspecified OutputKind = ""
	OutputResponse    OutputKind = "response"
	OutputPageItem    OutputKind = "page_item"
	OutputStreamEvent OutputKind = "stream_event"
)

type Route

type Route struct {
	Operation  string
	OutputKind OutputKind
}

Route identifies an operation independently of its presentation format.

type Transformer

type Transformer func(context.Context, gjson.Result) (gjson.Result, error)

Transformer changes one response or iterator value before presentation. Implementations must respect cancellation and must not consume other values.

func Select

func Select(_ Route) Transformer

Select is the SDK-owned hook for command-specific default transformations. The initial migration deliberately preserves every command's existing output.

Jump to

Keyboard shortcuts

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