Documentation
¶
Index ¶
- func ApplyMutations(body, query, header []byte) ([]byte, []byte, []byte, error)
- func ClearMutations()
- func Mutate(kind MutationKind, path string, value interface{})
- type JSONAnyFlag
- type JSONBoolFlag
- type JSONConfig
- type JSONDateFlag
- type JSONDateValueCreator
- type JSONDatetimeFlag
- type JSONFileFlag
- type JSONFloatFlag
- type JSONIntFlag
- type JSONStringFlag
- type JSONValueCreator
- type JsonFileValueCreator
- 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 interface{})
Mutate adds a mutation that will be applied to the specified kind of data
Types ¶
type JSONAnyFlag ¶
type JSONAnyFlag = cli.FlagBase[interface{}, JSONConfig, JSONValueCreator[interface{}]]
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 interface{}
}
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 JSONFileFlag ¶
type JSONFileFlag = cli.FlagBase[string, JSONConfig, JsonFileValueCreator]
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 JsonFileValueCreator ¶
type JsonFileValueCreator struct{}
JsonFileValueCreator handles file-based flags that read content and register with mutations
func (JsonFileValueCreator) Create ¶
func (c JsonFileValueCreator) Create(val string, dest *string, config JSONConfig) cli.Value
func (JsonFileValueCreator) ToString ¶
func (c JsonFileValueCreator) ToString(val string) string
type Mutation ¶
type Mutation struct {
Kind MutationKind
Path string
Value interface{}
}
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.