sampler

package
v0.0.0-...-f696b34 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sampler

type Sampler struct {
	// contains filtered or unexported fields
}

Sampler is a type that reads JSON documents and generates a list of keypaths derived from what it sees.

It works by scanning JSON down to a certain depth, and tracking all keys that it traverses before bottoming out at a scalar value. If it encounters an array, it will traverse all items in the array transparently, however, it will skip arrays of arrays to prevent smashing the stack.

func New

func New(maxDepth int) *Sampler

New creates a new sampler that will extract key paths down to maxDepth depth (<0) means no limit.

func (*Sampler) Keys

func (s *Sampler) Keys() []string

func (*Sampler) KeysAtThreshold

func (s *Sampler) KeysAtThreshold(thresholdPercent int) []string

func (*Sampler) Reset

func (s *Sampler) Reset()

func (*Sampler) Sample

func (s *Sampler) Sample(sample []byte) error

func (*Sampler) Scanned

func (s *Sampler) Scanned() int

type Stats

type Stats struct {
	DocsScanned     int
	TotalKeys       int
	KeysAtThreshold int
}

Jump to

Keyboard shortcuts

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