transform

package
v0.2.65 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SortKey

type SortKey struct {
	Field string
	Desc  bool
}

type Spec

type Spec struct {
	Root   string
	Where  string
	Sort   []SortKey
	Limit  int
	Select []string
}

Spec defines a simple JSON post-filter applied to tool outputs. Supported keys in selector suffix: root, where, sort, limit, select.

func ParseSuffix

func ParseSuffix(s string) *Spec

ParseSuffix parses a selector suffix like "root=$.items; where=name~=review|critique; sort=-rank,name; limit=5; select=id,name".

func (*Spec) Apply

func (s *Spec) Apply(data []byte) ([]byte, error)

Apply filters the input JSON bytes based on the spec and returns filtered JSON bytes.

Jump to

Keyboard shortcuts

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