Documentation
¶
Index ¶
- type SafeMethodArgs
- func (sma *SafeMethodArgs) BoolKwArg(name string, defaultValue bool) bool
- func (sma *SafeMethodArgs) Exists(name string) bool
- func (sma *SafeMethodArgs) ListKwArg(name string, defaultValue []any) []any
- func (sma *SafeMethodArgs) ListStrArg(idx int) ([]string, error)
- func (sma *SafeMethodArgs) MapKwArg(name string, defaultValue map[string]any) map[string]any
- func (sma *SafeMethodArgs) StrArg(idx int) (string, error)
- func (sma *SafeMethodArgs) StrKwArg(name, defaultValue string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SafeMethodArgs ¶
type SafeMethodArgs struct {
Args *plugin.MethodArgs
}
SafeMethodArgs provides safe access to KCL plugin method arguments.
func (*SafeMethodArgs) BoolKwArg ¶
func (sma *SafeMethodArgs) BoolKwArg(name string, defaultValue bool) bool
BoolKwArg returns the boolean keyword argument with the given name, or defaultValue if it doesn't exist.
func (*SafeMethodArgs) Exists ¶
func (sma *SafeMethodArgs) Exists(name string) bool
Exists checks if an argument with the given name exists.
func (*SafeMethodArgs) ListKwArg ¶
func (sma *SafeMethodArgs) ListKwArg(name string, defaultValue []any) []any
ListKwArg returns the list keyword argument with the given name, or defaultValue if it doesn't exist.
func (*SafeMethodArgs) ListStrArg ¶
func (sma *SafeMethodArgs) ListStrArg(idx int) ([]string, error)
ListStrArg returns the string list argument at the given index.
func (*SafeMethodArgs) MapKwArg ¶
MapKwArg returns the map keyword argument with the given name, or defaultValue if it doesn't exist.
func (*SafeMethodArgs) StrArg ¶
func (sma *SafeMethodArgs) StrArg(idx int) (string, error)
StrArg returns the string argument at the given index.
func (*SafeMethodArgs) StrKwArg ¶
func (sma *SafeMethodArgs) StrKwArg(name, defaultValue string) string
StrKwArg returns the string keyword argument with the given name, or defaultValue if it doesn't exist.