generator

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 7 Imported by: 7

Documentation

Index

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 GetTagsForGenInt32Task added in v0.1.2

func GetTagsForGenInt32Task(min int32, max int32) string

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 GenInt32Params

type GenInt32Params 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 NewGeneratedField(fqn string,
	value reflect.Value,
	tag reflect.StructTag,
	generator *Generator) *GeneratedField

func (*GeneratedField) SetValue added in v0.1.2

func (field *GeneratedField) SetValue() bool

type GenerationConfig

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(*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

func (*Generator) Copy added in v0.1.2

func (gd *Generator) Copy() (generationDefaults *Generator)

type IntConfig

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

type ParentType added in v1.1.1

type ParentType map[string]int

type SliceConfig

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

type Task

type Task struct {
	Name       TaskName
	Parameters string
	FieldName  string
}

func (*Task) GenInt32Params

func (t *Task) GenInt32Params() GenInt32Params

type TaskName

type TaskName string
const (
	GenInt32 TaskName = "GenInt32"
)

type ValueGenerationType

type ValueGenerationType uint8
const (
	Generate     ValueGenerationType = iota // will generate all field
	GenerateOnce                            // will generate all the fields
	UseDefaults
)

Jump to

Keyboard shortcuts

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