utils

package
v0.0.0-...-5298bac Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateJSONSchema

func GenerateJSONSchema(v interface{}) (json.RawMessage, error)

GenerateJSONSchema generates a JSON schema from a Go struct This is useful for creating tool input/output schemas

func JSONToStruct

func JSONToStruct(data json.RawMessage, v interface{}) error

JSONToStruct unmarshals JSON into a struct with better error messages

func MergeJSONObjects

func MergeJSONObjects(objects ...json.RawMessage) (json.RawMessage, error)

MergeJSONObjects merges multiple JSON objects, with later objects taking precedence

func ValidateAgainstSchema

func ValidateAgainstSchema(data json.RawMessage, schema json.RawMessage) error

ValidateAgainstSchema validates data against a JSON schema

Types

type GoroutineLeakDetector

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

GoroutineLeakDetector helps detect goroutine leaks in tests

func NewGoroutineLeakDetector

func NewGoroutineLeakDetector(t *testing.T) *GoroutineLeakDetector

NewGoroutineLeakDetector creates a new goroutine leak detector

func (*GoroutineLeakDetector) Check

func (d *GoroutineLeakDetector) Check()

Check verifies that goroutine count hasn't grown beyond allowed threshold

func (*GoroutineLeakDetector) SetAllowedGrowth

func (d *GoroutineLeakDetector) SetAllowedGrowth(n int) *GoroutineLeakDetector

SetAllowedGrowth sets the number of goroutines allowed to grow

func (*GoroutineLeakDetector) SetStabilizeDelay

func (d *GoroutineLeakDetector) SetStabilizeDelay(delay time.Duration) *GoroutineLeakDetector

SetStabilizeDelay sets the delay to allow goroutines to stabilize

func (*GoroutineLeakDetector) Start

func (d *GoroutineLeakDetector) Start()

Start records the initial goroutine count

Jump to

Keyboard shortcuts

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