Documentation
¶
Index ¶
- Constants
- func AddTask(task Task) error
- func GenerateBoolFunc() basicGenerationFunction
- func GenerateNilValueFunc() basicGenerationFunction
- func GetTagForTask(name TaskName, params ...any) reflect.StructTag
- func ValidateParamCount(task Task, taskProperties TaskProperties)
- type ConfigType
- type DateConfig
- type DefaultGenerationFunctionType
- type FloatConfig
- type GeneratedField
- type GenerationConfig
- func (gc *GenerationConfig) AllowRecursion(a bool) *GenerationConfig
- func (gc *GenerationConfig) Clone() (config *GenerationConfig)
- func (gc *GenerationConfig) SetDateEnd(end time.Time) *GenerationConfig
- func (gc *GenerationConfig) SetDateFormat(format string) *GenerationConfig
- func (gc *GenerationConfig) SetDateStart(start time.Time) *GenerationConfig
- func (gc *GenerationConfig) SetFloat32Max(max float32) *GenerationConfig
- func (gc *GenerationConfig) SetFloat32Min(min float32) *GenerationConfig
- func (gc *GenerationConfig) SetFloat64Max(max float64) *GenerationConfig
- func (gc *GenerationConfig) SetFloat64Min(min float64) *GenerationConfig
- func (gc *GenerationConfig) SetInt32Max(max int32) *GenerationConfig
- func (gc *GenerationConfig) SetInt32Min(min int32) *GenerationConfig
- func (gc *GenerationConfig) SetInt64Max(max int64) *GenerationConfig
- func (gc *GenerationConfig) SetInt64Min(min int64) *GenerationConfig
- func (gc *GenerationConfig) SetIntMax(max int) *GenerationConfig
- func (gc *GenerationConfig) SetIntMin(min int) *GenerationConfig
- func (gc *GenerationConfig) SetIntRange(min, max int) *GenerationConfig
- func (gc *GenerationConfig) SetNonRequiredFields(val bool) *GenerationConfig
- func (gc *GenerationConfig) SetRecursionCount(r uint) *GenerationConfig
- func (gc *GenerationConfig) SetSliceLengthMax(max int) *GenerationConfig
- func (gc *GenerationConfig) SetSliceLengthMin(min int) *GenerationConfig
- func (gc *GenerationConfig) SetValueGenerationType(valueGenerationType ValueGenerationType) *GenerationConfig
- type GenerationFunction
- func GenerateDateTimeBetweenDatesFunc(startDate, endDate time.Time) GenerationFunction
- func GenerateDateTimeFunc() GenerationFunction
- func GenerateFixedValueFunc[T any](n T) GenerationFunction
- func GenerateNumberFunc[n number](min, max n) GenerationFunction
- func GeneratePointerValueFunc(field *GeneratedField) GenerationFunction
- func GenerateSliceFunc(field *GeneratedField) GenerationFunction
- func GenerateStringFromRegexFunc(regex string) GenerationFunction
- func GenerateStructFunc(field *GeneratedField) GenerationFunction
- type GenerationFunctionImpl
- type GenerationUnit
- type GenerationValueConfig
- type Generator
- type IntConfig
- type SliceConfig
- type Task
- type TaskName
- type TaskProperties
- type ValueGenerationType
Constants ¶
View Source
const ISO8601 string = "2018-03-20T09:12:28Z"
Variables ¶
This section is empty.
Functions ¶
func GenerateBoolFunc ¶
func GenerateBoolFunc() basicGenerationFunction
func GenerateNilValueFunc ¶
func GenerateNilValueFunc() basicGenerationFunction
func ValidateParamCount ¶
func ValidateParamCount(task Task, taskProperties TaskProperties)
Types ¶
type ConfigType ¶ added in v0.1.2
type ConfigType interface {
IntConfig | FloatConfig | SliceConfig
}
type DateConfig ¶
type DateConfig struct {
// contains filtered or unexported fields
}
type DefaultGenerationFunctionType ¶ added in v0.1.2
type DefaultGenerationFunctionType map[reflect.Kind]GenerationFunction
type FloatConfig ¶
type FloatConfig struct {
// contains filtered or unexported fields
}
type GeneratedField ¶ added in v0.1.2
type GeneratedField struct {
Name string
Value reflect.Value
Tag reflect.StructTag
Generator *Generator
Parent *GeneratedField
PointerValue *reflect.Value
}
func NewGeneratedField ¶ added in v1.1.1
func (*GeneratedField) SetValue ¶ added in v0.1.2
func (field *GeneratedField) SetValue() bool
type GenerationConfig ¶
type GenerationConfig struct {
GenerationValueConfig
SliceConfig
IntConfig
FloatConfig
DateConfig
}
func NewGenerationConfig ¶
func NewGenerationConfig() (generationConfig *GenerationConfig)
func (*GenerationConfig) AllowRecursion ¶ added in v1.1.1
func (gc *GenerationConfig) AllowRecursion(a bool) *GenerationConfig
func (*GenerationConfig) Clone ¶ added in v0.1.2
func (gc *GenerationConfig) Clone() (config *GenerationConfig)
func (*GenerationConfig) SetDateEnd ¶
func (gc *GenerationConfig) SetDateEnd(end time.Time) *GenerationConfig
func (*GenerationConfig) SetDateFormat ¶
func (gc *GenerationConfig) SetDateFormat(format string) *GenerationConfig
func (*GenerationConfig) SetDateStart ¶
func (gc *GenerationConfig) SetDateStart(start time.Time) *GenerationConfig
func (*GenerationConfig) SetFloat32Max ¶
func (gc *GenerationConfig) SetFloat32Max(max float32) *GenerationConfig
func (*GenerationConfig) SetFloat32Min ¶
func (gc *GenerationConfig) SetFloat32Min(min float32) *GenerationConfig
func (*GenerationConfig) SetFloat64Max ¶
func (gc *GenerationConfig) SetFloat64Max(max float64) *GenerationConfig
func (*GenerationConfig) SetFloat64Min ¶
func (gc *GenerationConfig) SetFloat64Min(min float64) *GenerationConfig
func (*GenerationConfig) SetInt32Max ¶
func (gc *GenerationConfig) SetInt32Max(max int32) *GenerationConfig
func (*GenerationConfig) SetInt32Min ¶
func (gc *GenerationConfig) SetInt32Min(min int32) *GenerationConfig
func (*GenerationConfig) SetInt64Max ¶
func (gc *GenerationConfig) SetInt64Max(max int64) *GenerationConfig
func (*GenerationConfig) SetInt64Min ¶
func (gc *GenerationConfig) SetInt64Min(min int64) *GenerationConfig
func (*GenerationConfig) SetIntMax ¶
func (gc *GenerationConfig) SetIntMax(max int) *GenerationConfig
deprecated: use SetIntRange
func (*GenerationConfig) SetIntMin ¶
func (gc *GenerationConfig) SetIntMin(min int) *GenerationConfig
func (*GenerationConfig) SetIntRange ¶ added in v1.1.0
func (gc *GenerationConfig) SetIntRange(min, max int) *GenerationConfig
func (*GenerationConfig) SetNonRequiredFields ¶
func (gc *GenerationConfig) SetNonRequiredFields(val bool) *GenerationConfig
func (*GenerationConfig) SetRecursionCount ¶ added in v1.1.1
func (gc *GenerationConfig) SetRecursionCount(r uint) *GenerationConfig
func (*GenerationConfig) SetSliceLengthMax ¶
func (gc *GenerationConfig) SetSliceLengthMax(max int) *GenerationConfig
func (*GenerationConfig) SetSliceLengthMin ¶
func (gc *GenerationConfig) SetSliceLengthMin(min int) *GenerationConfig
func (*GenerationConfig) SetValueGenerationType ¶
func (gc *GenerationConfig) SetValueGenerationType(valueGenerationType ValueGenerationType) *GenerationConfig
type GenerationFunction ¶
type GenerationFunction interface {
Generate() any
// Copy copies the generation config and returns a copy of it with the same config
// as the origin generation config
Copy(*GenerationConfig) GenerationFunction
GetGenerationConfig() *GenerationConfig
SetGenerationConfig(*GenerationConfig) GenerationFunction
}
func GenerateDateTimeBetweenDatesFunc ¶
func GenerateDateTimeBetweenDatesFunc(startDate, endDate time.Time) GenerationFunction
func GenerateDateTimeFunc ¶
func GenerateDateTimeFunc() GenerationFunction
func GenerateFixedValueFunc ¶
func GenerateFixedValueFunc[T any](n T) GenerationFunction
func GenerateNumberFunc ¶
func GenerateNumberFunc[n number](min, max n) GenerationFunction
func GeneratePointerValueFunc ¶
func GeneratePointerValueFunc(field *GeneratedField) GenerationFunction
func GenerateSliceFunc ¶
func GenerateSliceFunc(field *GeneratedField) GenerationFunction
func GenerateStringFromRegexFunc ¶
func GenerateStringFromRegexFunc(regex string) GenerationFunction
func GenerateStructFunc ¶
func GenerateStructFunc(field *GeneratedField) GenerationFunction
type GenerationFunctionImpl ¶ added in v0.1.2
type GenerationFunctionImpl struct {
*GenerationConfig
// contains filtered or unexported fields
}
func (GenerationFunctionImpl) Copy ¶ added in v0.1.2
func (bsf GenerationFunctionImpl) Copy(*GenerationConfig) GenerationFunction
func (GenerationFunctionImpl) Generate ¶ added in v0.1.2
func (bsf GenerationFunctionImpl) Generate() any
func (GenerationFunctionImpl) GetGenerationConfig ¶ added in v0.1.2
func (bsf GenerationFunctionImpl) GetGenerationConfig() *GenerationConfig
func (GenerationFunctionImpl) SetGenerationConfig ¶ added in v0.1.2
func (bsf GenerationFunctionImpl) SetGenerationConfig(*GenerationConfig) GenerationFunction
type GenerationUnit ¶
type GenerationUnit struct {
PreviousValueConfig GenerationValueConfig
CurrentFunction GenerationFunction
UpdateCurrentFunction bool
Field *GeneratedField
// contains filtered or unexported fields
}
func NewGenerationUnit ¶
func NewGenerationUnit(field *GeneratedField) *GenerationUnit
func (*GenerationUnit) Generate ¶
func (gu *GenerationUnit) Generate() any
type GenerationValueConfig ¶
type GenerationValueConfig struct {
// contains filtered or unexported fields
}
type Generator ¶ added in v0.1.2
type Generator struct {
GenerationConfig *GenerationConfig
DefaultGenerationFunctions DefaultGenerationFunctionType
}
func NewGenerator ¶ added in v1.1.1
func NewGenerator(gc *GenerationConfig) *Generator
type SliceConfig ¶
type SliceConfig struct {
// contains filtered or unexported fields
}
type Task ¶
type Task interface {
GenerationFunction(taskProperties TaskProperties) GenerationFunction
ExpectedParameterCount() int
Name() string
}
type TaskProperties ¶ added in v0.1.0
func CreateTaskProperties ¶
func CreateTaskProperties(fieldName string, tags reflect.StructTag) (*TaskProperties, error)
type ValueGenerationType ¶
type ValueGenerationType uint8
const ( Generate ValueGenerationType = iota // will generate all field GenerateOnce // will generate all the fields UseDefaults )
Click to show internal directories.
Click to hide internal directories.