Documentation
¶
Index ¶
- func SetGenerateUniqueValues(unique bool)
- func SetIgnoreInterface(ignore bool)
- func SetRandomMapAndSliceMaxSize(size int) error
- func SetRandomMapAndSliceMinSize(size int) error
- func SetRandomMapAndSliceSize(size int) error
- func SetRandomNumberBoundaries(start, end int) error
- func SetRandomStringLength(size int) error
- func SetStringLang(l interfaces.LangRuneBoundary)
- type MaxDepthOption
- type OptionFunc
- func WithCustomFieldProvider(fieldName string, provider interfaces.CustomProviderFunction) OptionFunc
- func WithFieldsToIgnore(fieldNames ...string) OptionFunc
- func WithGenerateUniqueValues(unique bool) OptionFunc
- func WithIgnoreInterface(value bool) OptionFunc
- func WithMaxGenerateStringRetries(retries uint) OptionFunc
- func WithNilIfLenIsZero(setNil bool) OptionFunc
- func WithRandomFloatBoundaries(boundary interfaces.RandomFloatBoundary) OptionFunc
- func WithRandomIntegerBoundaries(boundary interfaces.RandomIntegerBoundary) OptionFunc
- func WithRandomMapAndSliceMaxSize(size uint) OptionFunc
- func WithRandomMapAndSliceMinSize(size uint) OptionFunc
- func WithRandomStringLength(size uint) OptionFunc
- func WithRecursionMaxDepth(depth uint) OptionFunc
- func WithSliceMapRandomToZero(setNumberToZero bool) OptionFunc
- func WithStringLanguage(l interfaces.LangRuneBoundary) OptionFunc
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetGenerateUniqueValues ¶
func SetGenerateUniqueValues(unique bool)
SetGenerateUniqueValues allows to set the single fake data generator functions to generate unique data.
func SetIgnoreInterface ¶
func SetIgnoreInterface(ignore bool)
SetIgnoreInterface allows to set a flag to ignore found interface{}s.
func SetRandomMapAndSliceMaxSize ¶
SetRandomMapAndSliceMaxSize sets the max size for maps and slices for random generation.
func SetRandomMapAndSliceMinSize ¶
SetRandomMapAndSliceMinSize sets the min size for maps and slices for random generation.
func SetRandomMapAndSliceSize ¶
SetRandomMapAndSliceSize sets the size for maps and slices for random generation. deprecates, currently left for old version usage
func SetRandomNumberBoundaries ¶
SetRandomNumberBoundaries sets boundary for random number generation
func SetRandomStringLength ¶
SetRandomStringLength sets a length for random string generation
func SetStringLang ¶
func SetStringLang(l interfaces.LangRuneBoundary)
SetStringLang sets language of random string generation (LangENG, LangCHI, LangRUS, LangJPN, LangKOR, EmotEMJ)
Types ¶
type MaxDepthOption ¶
type MaxDepthOption struct {
// contains filtered or unexported fields
}
MaxDepthOption used for configuring the max depth of nested struct for faker
func (*MaxDepthOption) ForgetType ¶
func (o *MaxDepthOption) ForgetType(t reflect.Type)
func (*MaxDepthOption) RecursionOutOfLimit ¶
func (o *MaxDepthOption) RecursionOutOfLimit(t reflect.Type) bool
func (*MaxDepthOption) RememberType ¶
func (o *MaxDepthOption) RememberType(t reflect.Type)
type OptionFunc ¶
type OptionFunc func(oo *Options)
OptionFunc define the options contract
func WithCustomFieldProvider ¶
func WithCustomFieldProvider(fieldName string, provider interfaces.CustomProviderFunction) OptionFunc
WithCustomFieldProvider used for storing the custom provider function
func WithFieldsToIgnore ¶
func WithFieldsToIgnore(fieldNames ...string) OptionFunc
WithFieldsToIgnore used for ignoring a field when generating the fake data
func WithGenerateUniqueValues ¶
func WithGenerateUniqueValues(unique bool) OptionFunc
WithGenerateUniqueValues allows to set the single fake data generator functions to generate unique data.
func WithIgnoreInterface ¶
func WithIgnoreInterface(value bool) OptionFunc
WithIgnoreInterface allows to set a flag to ignore found interface{}s.
func WithMaxGenerateStringRetries ¶
func WithMaxGenerateStringRetries(retries uint) OptionFunc
WithMaxGenerateStringRetries set how much tries for generating random string
func WithNilIfLenIsZero ¶
func WithNilIfLenIsZero(setNil bool) OptionFunc
WithNilIfLenIsZero allows to set nil for the slice and maps, if size is 0.
func WithRandomFloatBoundaries ¶
func WithRandomFloatBoundaries(boundary interfaces.RandomFloatBoundary) OptionFunc
WithRandomFloatBoundaries sets the boundary for random float value generation. Boundaries should comply with float values constraints (IEEE 754)
func WithRandomIntegerBoundaries ¶
func WithRandomIntegerBoundaries(boundary interfaces.RandomIntegerBoundary) OptionFunc
WithRandomIntegerBoundaries sets boundary random integer value generation. Boundaries can not exceed integer(4 byte...)
func WithRandomMapAndSliceMaxSize ¶
func WithRandomMapAndSliceMaxSize(size uint) OptionFunc
WithRandomMapAndSliceMaxSize sets the max size for maps and slices for random generation.
func WithRandomMapAndSliceMinSize ¶
func WithRandomMapAndSliceMinSize(size uint) OptionFunc
WithRandomMapAndSliceMinSize sets the min size for maps and slices for random generation.
func WithRandomStringLength ¶
func WithRandomStringLength(size uint) OptionFunc
WithRandomStringLength sets a length for random string generation
func WithRecursionMaxDepth ¶
func WithRecursionMaxDepth(depth uint) OptionFunc
WithRecursionMaxDepth used for configuring the max depth of recursion struct for faker
func WithSliceMapRandomToZero ¶
func WithSliceMapRandomToZero(setNumberToZero bool) OptionFunc
WithSliceMapRandomToZero Sets random integer generation to zero for slice and maps
func WithStringLanguage ¶
func WithStringLanguage(l interfaces.LangRuneBoundary) OptionFunc
WithStringLanguage sets language of random string generation (LangENG, LangCHI, LangRUS, LangJPN, LangKOR, EmotEMJ)
type Options ¶
type Options struct {
// IgnoreFields used for ignoring a field when generating the fake data
IgnoreFields map[string]struct{}
// FieldProviders used for storing the custom provider function
FieldProviders map[string]interfaces.CustomProviderFunction
// MaxDepthOption used for configuring the max depth of nested struct for faker
MaxDepthOption *MaxDepthOption
// IgnoreInterface used for ignoring any interface field
IgnoreInterface bool
// StringLanguage used for setting the language for any string in faker
StringLanguage *interfaces.LangRuneBoundary
// GenerateUniqueValues to ensure the generated data is unique
GenerateUniqueValues bool
// RandomStringLength to ensure the generated string is expected as we want
RandomStringLength int
// RandomMaxSliceSize used for setting the maximum of slice size, or map size that will be generated
RandomMaxSliceSize int
// RandomMinSliceSize used for setting the minimum of slize, array, map size that will be generated
RandomMinSliceSize int
// MaxGenerateStringRetries set how much tries for generating random string
MaxGenerateStringRetries int
// SetSliceMapNilIfLenZero allows to set nil for the slice and maps, if size is 0.
SetSliceMapNilIfLenZero bool
// SetSliceMapRandomToZero sets random integer generation to zero for slice and maps
SetSliceMapRandomToZero bool
// RandomIntegerBoundary sets boundary random integer value generation. Boundaries can not exceed integer(4 byte...)
RandomIntegerBoundary *interfaces.RandomIntegerBoundary
// RandomFloatBoundary sets the boundary for random float value generation. Boundaries should comply with float values constraints (IEEE 754)
RandomFloatBoundary *interfaces.RandomFloatBoundary
}
Options represent all available option for faker.
func BuildOptions ¶
func BuildOptions(optFuncs []OptionFunc) *Options
BuildOptions build all option functions into one option