explore

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(objects []any) int

Count returns the number of objects.

func Head(objects []any, n int) []any

Head returns the first n objects.

func ListFields

func ListFields(objects []any) []string

ListFields returns a sorted list of all unique dot-paths.

func Sample

func Sample(objects []any, n int) []any

Sample returns n randomly selected objects.

func Tail

func Tail(objects []any, n int) []any

Tail returns the last n objects.

Types

type FindOpts

type FindOpts struct {
	CaseInsensitive bool
	Regex           bool
	Keys            bool
	First           int // 0 means no limit
}

FindOpts configures find behaviour.

type FindResult

type FindResult struct {
	Index int    // object index
	Path  string // dot-path where found
	Value string // the matching value
	File  string // source filename (if available)
}

FindResult represents a full-text search match.

func Find

func Find(objects []any, pattern string, opts FindOpts) []FindResult

Find performs full-text search across all values.

type NumericStat

type NumericStat struct {
	Min, Max, Mean, Median float64
	P95, P99               float64
}

NumericStat holds numeric field statistics.

type SchemaField

type SchemaField struct {
	Path      string   // e.g. ".error.message"
	Types     []string // e.g. ["string", "null"]
	Frequency float64  // 0.0 to 1.0
	Examples  []any    // sample values
	Unique    int      // count of unique values (approx for large sets)
}

SchemaField represents one field in the inferred schema.

func InferSchema

func InferSchema(objects []any, opts SchemaOpts) []SchemaField

InferSchema walks all objects and collects field paths with types and frequencies.

type SchemaOpts

type SchemaOpts struct {
	MaxExamples int
}

SchemaOpts configures schema inference.

type Stats

type Stats struct {
	Count        int
	SchemaCount  int // distinct shapes
	Fields       int // unique field paths
	NumericStats map[string]NumericStat
	StringStats  map[string]StringStat
	NullCounts   map[string]int
}

Stats represents statistical summary.

func ComputeStats

func ComputeStats(objects []any) *Stats

ComputeStats computes statistical summary of objects.

type StringStat

type StringStat struct {
	Unique    int
	TopValues map[string]int // value -> count
}

StringStat holds string field statistics.

type TreeNode

type TreeNode struct {
	Path     string
	Type     string // "string", "number", "object", "array[string]", etc.
	Optional bool
	Children []*TreeNode
	Unique   int // unique value count, 0 if not tracked
}

TreeNode represents one node in the structure tree.

func BuildTree

func BuildTree(objects []any, opts TreeOpts) *TreeNode

BuildTree builds a hierarchical tree of field paths.

type TreeOpts

type TreeOpts struct {
	TrackUnique bool
}

TreeOpts configures tree building.

Jump to

Keyboard shortcuts

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