Documentation ¶
Index ¶
- Constants
- func EnumInt(anyArr ...any) (n int64)
- func EnumString(anyArr ...any) string
- func ExtractTopPrimitiveAttributes(b []byte, max int) (res []string)
- func ExtractTypes(val any, dataTemplate DataTemplateRequest) any
- func FileProperty(fileName string, name string) any
- func FindVariable(name string, data any) any
- func FlatRegexMap(val any) map[string]string
- func GenerateFuzzData(val any) any
- func ParseTemplate(dir string, byteBody []byte, data any) ([]byte, error)
- func PrefixTypeStringToRegEx(val string, dataTemplate DataTemplateRequest) string
- func RandAddress() string
- func RandBool() bool
- func RandCity() string
- func RandCountry() string
- func RandCountryCode() string
- func RandEin() string
- func RandEmail() string
- func RandFileLine(fileName string) string
- func RandFirstFemaleName() string
- func RandFirstMaleName() string
- func RandFirstName() string
- func RandFloatMax(max float64) float64
- func RandFloatMinMax(min, max float64) float64
- func RandHost() string
- func RandIntArrayMinMax(min int, max int) []int
- func RandIntMax(max int) int
- func RandIntMinMax(min, max int) int
- func RandItin() string
- func RandLastName() string
- func RandName() string
- func RandParagraph(min, max int) string
- func RandPhone() string
- func RandRegex(re string) string
- func RandSentence(min, max int) string
- func RandSsn() string
- func RandString(n int) string
- func RandStringArrayMinMax(min int, max int) []string
- func RandStringMinMax(min int, max int) string
- func RandTriString(sep string) string
- func RandURL() string
- func RandUSState() string
- func RandUSStateAbbr() string
- func RandWord(min, max int) string
- func ReMarshalArrayOrObjectWithIndent(b []byte) string
- func SeededAddress(seed int64) string
- func SeededBool(seed int64) bool
- func SeededCity(seed int64) string
- func SeededCountry(seed int64) string
- func SeededCountryCode(seed int64) string
- func SeededFileLine(fileName string, seed int64) string
- func SeededFirstFemaleName(seed int64) string
- func SeededFirstMaleName(seed int64) string
- func SeededFirstName(seed int64) string
- func SeededLastName(seed int64) string
- func SeededName(seed int64) string
- func SeededRandFloatMax(seed int64, min, max float64) float64
- func SeededRandIntMax(seed int64, min, max int) int
- func SeededTriString(seed int64, sep string) string
- func SeededUSPostal(state string, seed int64) string
- func SeededUSState(seed int64) string
- func SeededUSStateAbbr(seed int64) string
- func SeededUUID(seed int64) string
- func StripTypeTags(re string) string
- func TemplateFuncs(dir string, data any) template.FuncMap
- func ToFloat64(input any) (res float64)
- func UUID() string
- func UnmarshalArrayOrObject(b []byte) (res any, err error)
- func UnmarshalArrayOrObjectAndExtractTypes(str string, dataTemplate DataTemplateRequest) (map[string]string, error)
- func UnmarshalArrayOrObjectAndExtractTypesAndMarshal(str string, dataTemplate DataTemplateRequest) (string, error)
- func ValidateRegexMap(val any, regex map[string]string) error
- func ValueToRegEx(val string, dataTemplate DataTemplateRequest) string
- func VariableContains(name string, targets []any, data any) bool
- func VariableEquals(name string, data any, target any) bool
- func VariableNumber(name string, data any) float64
- func VariableSize(name string, data any) int
- type DataTemplateRequest
Constants ¶
const AnyWordRegex = `\w+`
AnyWordRegex constant
const BooleanPrefixRegex = PrefixTypeBoolean + `(false|true)`
BooleanPrefixRegex constant
const EmailRegex = `\w+@\w+\\.\w+`
EmailRegex constant
const EmailRegex2 = `\w+@\w+.?\w+`
EmailRegex2 constant
const EmailRegex3 = `.+@.+\..+`
EmailRegex3 constant
const EmailRegex4 = `.+@.+\\..+`
EmailRegex4 constant
const FixtureDataExt = ".dat"
FixtureDataExt extension
const IntPrefixRegex = PrefixTypeNumber + `[+-]?\d{1,10}`
IntPrefixRegex constant
const NumberPrefixRegex = PrefixTypeNumber + `[+-]?((\d{1,10}(\.\d{1,5})?)|(\.\d{1,10}))`
NumberPrefixRegex constant
const PrefixTypeArray = "__array__"
PrefixTypeArray type
const PrefixTypeBoolean = "__boolean__"
PrefixTypeBoolean type
const PrefixTypeExample = "__example__"
PrefixTypeExample type
const PrefixTypeNumber = "__number__"
PrefixTypeNumber type
const PrefixTypeObject = "__object__"
PrefixTypeObject type
const PrefixTypeString = "__string__"
PrefixTypeString type
const RequestCount = "_RequestCount"
RequestCount name
const UintPrefixRegex = PrefixTypeNumber + `\d{1,10}`
UintPrefixRegex constant
const UnescapeHTML = "UnescapeHTML"
UnescapeHTML flag
const WildRegex = `.+`
WildRegex constant
Variables ¶
This section is empty.
Functions ¶
func ExtractTopPrimitiveAttributes ¶
ExtractTopPrimitiveAttributes to fetch attributes
func ExtractTypes ¶
func ExtractTypes(val any, dataTemplate DataTemplateRequest) any
ExtractTypes extract types from any structure
func FindVariable ¶
FindVariable extracts variable property
func FlatRegexMap ¶
FlatRegexMap to add all regex in same map
func GenerateFuzzData ¶
GenerateFuzzData using regex, data or types
func ParseTemplate ¶
ParseTemplate parses GO template with dynamic parameters
func PrefixTypeStringToRegEx ¶
func PrefixTypeStringToRegEx(val string, dataTemplate DataTemplateRequest) string
PrefixTypeStringToRegEx helper method for adding prefix and regex
func RandEin ¶
func RandEin() string
RandEin Generate a random United States Employer Identification Number EIN).
func RandFloatMax ¶
RandFloatMax returns random number between 0 and max
func RandFloatMinMax ¶
RandFloatMinMax returns random number between min and max
func RandIntArrayMinMax ¶
RandIntArrayMinMax generator
func RandIntMinMax ¶
RandIntMinMax returns random number between min and max
func RandItin ¶
func RandItin() string
RandItin generator for random United States Individual Taxpayer Identification Number ITIN).
func RandParagraph ¶
RandParagraph generate a paragraph with at least min sentences and at most max sentences.
func RandSentence ¶
RandSentence generate a sentence with at least min words and at most max words.
func RandSsn ¶
func RandSsn() string
RandSsn Generate a random invalid United States Social Security Identification Number SSN).
func RandStringArrayMinMax ¶
RandStringArrayMinMax generator
func ReMarshalArrayOrObjectWithIndent ¶
ReMarshalArrayOrObjectWithIndent helper method to unmarshal and marshal with indent
func SeededCountryCode ¶
SeededCountryCode country generator
func SeededFileLine ¶
SeededFileLine generator
func SeededFirstFemaleName ¶
SeededFirstFemaleName first name
func SeededFirstMaleName ¶
SeededFirstMaleName first name
func SeededRandFloatMax ¶
SeededRandFloatMax returns random number with seed upto a max
func SeededRandIntMax ¶
SeededRandIntMax returns random number with seed upto a max
func SeededTriString ¶
SeededTriString phrase generator
func SeededUSPostal ¶
SeededUSPostal Generate US postal code
func SeededUSStateAbbr ¶
SeededUSStateAbbr Generate US State
func TemplateFuncs ¶
TemplateFuncs returns template functions
func UnmarshalArrayOrObject ¶
UnmarshalArrayOrObject helper function to unmarshal bytes based on object/array
func UnmarshalArrayOrObjectAndExtractTypes ¶
func UnmarshalArrayOrObjectAndExtractTypes(str string, dataTemplate DataTemplateRequest) (map[string]string, error)
UnmarshalArrayOrObjectAndExtractTypes helper method to unmarshal, add types and marshal again
func UnmarshalArrayOrObjectAndExtractTypesAndMarshal ¶
func UnmarshalArrayOrObjectAndExtractTypesAndMarshal(str string, dataTemplate DataTemplateRequest) (string, error)
UnmarshalArrayOrObjectAndExtractTypesAndMarshal helper method to unmarshal, add types and marshal again
func ValidateRegexMap ¶
ValidateRegexMap validate data against regex map
func ValueToRegEx ¶
func ValueToRegEx(val string, dataTemplate DataTemplateRequest) string
ValueToRegEx value to regex
func VariableContains ¶
VariableContains checks if variable contains value
func VariableEquals ¶
VariableEquals checks if variable is equal to the value
func VariableNumber ¶
VariableNumber returns numeric value for variable
func VariableSize ¶
VariableSize finds size of the variable
Types ¶
type DataTemplateRequest ¶
type DataTemplateRequest struct { IncludeType bool `yaml:"include_type" json:"include_type"` MinMultiplier int `yaml:"min_multiplier" json:"min_multiplier"` MaxMultiplier int `yaml:"max_multiplier" json:"max_multiplier"` }
DataTemplateRequest for generating random data pattern
func NewDataTemplateRequest ¶
func NewDataTemplateRequest(includeType bool, minMultiplier int, maxMultiplier int) DataTemplateRequest
NewDataTemplateRequest constructor
func (DataTemplateRequest) WithInclude ¶
func (dtr DataTemplateRequest) WithInclude(includeType bool) DataTemplateRequest
WithInclude instantiates copy with a new include type
func (DataTemplateRequest) WithMaxMultiplier ¶
func (dtr DataTemplateRequest) WithMaxMultiplier(multiplier int) DataTemplateRequest
WithMaxMultiplier instantiates copy with a new max multiplier