modifiers

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToFloatModifier

func ConvertToFloatModifier(i interface{}) (interface{}, error)

ConvertToFloatModifier -- convert a scaler to a floating value

func ConvertToIntModifier

func ConvertToIntModifier(i interface{}) (interface{}, error)

ConvertToIntModifier -- A value modifier to make a string or a float64 an integer (float64's will round down) Note: XML floats are strings, need to be converted to float then an int

func FirstModifier added in v1.3.0

func FirstModifier(i interface{}) (interface{}, error)

FirstModifier -- get the first element from an array

func LengthModifier

func LengthModifier(i interface{}) (interface{}, error)

LengthModifier -- Convert the interface value to a length if valid or return error

func NilModifier

func NilModifier(i interface{}) (interface{}, error)

NilModifier -- converts a nil to a string

func NullModifier

func NullModifier(i interface{}) (interface{}, error)

NullModifier -- performs a NOP

func QuoteModifier

func QuoteModifier(i interface{}) (interface{}, error)

QuoteModifier -- quote a string

func QuoteString

func QuoteString(input string) string

QuoteString -- Quote a string handling '\"' as well

func StringToLowerModifier

func StringToLowerModifier(i interface{}) (interface{}, error)

func StringToUpperModifier

func StringToUpperModifier(i interface{}) (interface{}, error)

Types

type ModifierOptions

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

ModifierOptions -- Common options for modifiers

func AddModifierOptions

func AddModifierOptions(set shell.CmdSet) ModifierOptions

AddModifierOptions -- Add options for modifiers

type ValueModifier

type ValueModifier func(i interface{}) (interface{}, error)

ValueModifier -- a function for modifying a value in a chain

func ConstructModifier

func ConstructModifier(options ModifierOptions) ValueModifier

ConstructModifier -- Build a modifier chain based on common options

func MakeFirstModifier added in v1.3.0

func MakeFirstModifier(vmod ValueModifier) ValueModifier

func MakeLengthModifier

func MakeLengthModifier(vmod ValueModifier) ValueModifier

func MakeQuoteModifier

func MakeQuoteModifier(vmod ValueModifier) ValueModifier

MakeQuoteModifier -- create a modifier for quoting a string

func MakeRegExModifier

func MakeRegExModifier(pattern string, vmod ValueModifier) ValueModifier

func MakeStringToLowerModifier

func MakeStringToLowerModifier(vmod ValueModifier) ValueModifier

func MakeStringToUpperModifier

func MakeStringToUpperModifier(vmod ValueModifier) ValueModifier

func MakeToFloatModifier

func MakeToFloatModifier(vmod ValueModifier) ValueModifier

func MakeToIntModifier

func MakeToIntModifier(vmod ValueModifier) ValueModifier

Jump to

Keyboard shortcuts

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