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

projection

package
v0.99.8 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package projection trims structured values down to selected fields so automations and LLM/agent flows stop paying tokens for payloads they never read.

It works on any JSON-marshalable value — every unified model in the parent SDK (ChangeRequest, Issue, CommitStatus, ...) carries json tags and qualifies. Projection is applied AFTER JSON normalization, so paths use the marshaled (snake_case) field names, nested pointers are transparent, and slices are traversed element-wise.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Project

func Project(v any, fields ...string) (map[string]any, error)

Project marshals v, then prunes the document down to fields. Paths are dotted ("head.ref"); a path segment applied to an array projects each element; the "*" field means "everything" and returns the unpruned document.

An empty field list is an error: the whole point of the helper is to make payloads small, and silently returning the full document would be the exact failure mode it exists to prevent.

func ProjectList

func ProjectList[T any](items []T, fields ...string) ([]map[string]any, error)

ProjectList projects every element of items with the same field list, preserving order — the list-shape helper for "show me 50 PRs as number/title/author".

Types

This section is empty.

Jump to

Keyboard shortcuts

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