Documentation ¶
Index ¶
- func AssertStructValues(t *testing.T, i interface{}, isException func(string) bool, values *Values)
- func BuildString(nRunes int) string
- func BuildStringWith(nRunes int, r rune) string
- func DecodeData(t *testing.T, r io.Reader, eventType string, out interface{})
- func DecodeDataWithReplacement(t *testing.T, r io.Reader, eventType string, newData string, out interface{}, ...)
- func InitStructValues(i interface{})
- func IterateStruct(i interface{}, fn func(reflect.Value, string))
- func SetStructValues(in interface{}, values *Values, opts ...SetStructValuesOption)
- func SetZeroStructValue(i interface{}, callback func(string))
- func SetZeroStructValues(i interface{})
- type SetStructValuesOption
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertStructValues ¶
AssertStructValues recursively walks through the given struct and asserts that values are equal to expected values
func BuildString ¶
BuildString creates a string conisisting of nRunes runes
func BuildStringWith ¶
BuildStringWith creates a string conisisting of nRunes of the given rune
func DecodeData ¶
DecodeData decodes input from the io.Reader into the given output it skips events with a different type than the given eventType and decodes the first matching event type
func DecodeDataWithReplacement ¶
func DecodeDataWithReplacement(t *testing.T, r io.Reader, eventType string, newData string, out interface{}, keys ...string)
DecodeDataWithReplacement decodes input from the io.Reader and replaces data for the given key with the provided newData before decoding into the output
func InitStructValues ¶
func InitStructValues(i interface{})
InitStructValues iterates through the struct fields represented by the given reflect.Value and initializes all fields with some arbitrary value.
func IterateStruct ¶
IterateStruct iterates through the struct fields represented by the given reflect.Value and calls the given function on every field.
func SetStructValues ¶
func SetStructValues(in interface{}, values *Values, opts ...SetStructValuesOption)
SetStructValues iterates through the struct fields represented by the given reflect.Value and initializes all fields with the provided values
func SetZeroStructValue ¶
func SetZeroStructValue(i interface{}, callback func(string))
SetZeroStructValue iterates through the struct fields represented by the given reflect.Value, sets a field to its zero value, calls the callback function and resets the field to its original value
func SetZeroStructValues ¶
func SetZeroStructValues(i interface{})
SetZeroStructValues iterates through the struct fields represented by the given reflect.Value and sets all fields to their zero values.
Types ¶
type SetStructValuesOption ¶
SetStructValuesOption is the type of an option which may be passed into SetStructValues to override the value to which a field is set. If the option returns false, then the field will not be updated and no more options will be invoked.
type Values ¶
type Values struct { Str string Int int Float float64 Bool bool Duration time.Duration IP *modelpb.IP HTTPHeader http.Header LabelVal *modelpb.LabelValue NumericLabelVal *modelpb.NumericLabelValue // N controls how many elements are added to a slice or a map N int }
Values used for populating the model structs
func DefaultValues ¶
func DefaultValues() *Values
DefaultValues returns a Values struct initialized with non-zero values
func NonDefaultValues ¶
func NonDefaultValues() *Values
NonDefaultValues returns a Values struct initialized with non-zero values