Documentation
¶
Index ¶
- func ApplyMutations(body, query, header []byte) ([]byte, []byte, []byte, error)
- func ClearMutations()
- func Mutate(kind MutationKind, path string, value any)
- type JSONAnyFlag
- type JSONBoolFlag
- type JSONConfig
- type JSONDateFlag
- type JSONDateValueCreator
- type JSONDatetimeFlag
- type JSONFloatFlag
- type JSONIntFlag
- type JSONStringFlag
- type JSONValueCreator
- type Mutation
- type MutationKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyMutations ¶
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 JSONAnyFlag ¶
type JSONAnyFlag = cli.FlagBase[any, JSONConfig, JSONValueCreator[any]]
type JSONBoolFlag ¶
type JSONBoolFlag = cli.FlagBase[bool, JSONConfig, JSONValueCreator[bool]]
type JSONConfig ¶
type JSONConfig struct {
Kind MutationKind
Path string
// For boolean flags that set a specific value when present
SetValue any
}
type JSONDateFlag ¶
type JSONDateFlag = cli.FlagBase[time.Time, JSONConfig, JSONDateValueCreator]
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
type JSONDatetimeFlag ¶
type JSONDatetimeFlag = cli.FlagBase[time.Time, JSONConfig, JSONValueCreator[time.Time]]
type JSONFloatFlag ¶
type JSONFloatFlag = cli.FlagBase[float64, JSONConfig, JSONValueCreator[float64]]
type JSONIntFlag ¶
type JSONIntFlag = cli.FlagBase[int, JSONConfig, JSONValueCreator[int]]
type JSONStringFlag ¶
type JSONStringFlag = cli.FlagBase[string, JSONConfig, JSONValueCreator[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" )
Click to show internal directories.
Click to hide internal directories.