jsonflag

package
v0.1.0-alpha.56 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMutations

func ApplyMutations(body, query, header []byte) ([]byte, []byte, []byte, error)

ApplyMutations applies all registered mutations to the provided JSON data

func ClearMutations

func ClearMutations()

ClearMutations removes all registered mutations from the global registry

func Mutate

func Mutate(kind MutationKind, path string, value any)

Mutate adds a mutation that will be applied to the specified kind of data

Types

type JSONConfig

type JSONConfig struct {
	Kind MutationKind
	Path string
	// For boolean flags that set a specific value when present
	SetValue any
}

type JSONDateValueCreator

type JSONDateValueCreator struct{}

JSONDateValueCreator is a specialized creator for date-only values

func (JSONDateValueCreator) Create

func (c JSONDateValueCreator) Create(val time.Time, dest *time.Time, config JSONConfig) cli.Value

func (JSONDateValueCreator) ToString

func (c JSONDateValueCreator) ToString(val time.Time) string

type JSONValueCreator

type JSONValueCreator[T any] struct{}

func (JSONValueCreator[T]) Create

func (c JSONValueCreator[T]) Create(val T, dest *T, config JSONConfig) cli.Value

func (JSONValueCreator[T]) ToString

func (c JSONValueCreator[T]) ToString(val T) string

type Mutation

type Mutation struct {
	Kind  MutationKind
	Path  string
	Value any
}

func ListMutations

func ListMutations() []Mutation

ListMutations returns a copy of all currently registered mutations

type MutationKind

type MutationKind string
const (
	Body   MutationKind = "body"
	Query  MutationKind = "query"
	Header MutationKind = "header"
)

Jump to

Keyboard shortcuts

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