Documentation ¶
Index ¶
- Constants
- Variables
- func GetMinAndMaxNumericValueBySetting(digitsBeforeDecimal int) (decimal.Decimal, decimal.Decimal, error)
- func ModifyMacAddress(newMac, original net.HardwareAddr, keepOriginalVendor bool, ...) ([]byte, error)
- func RandomBytesToHardwareAddr(originalBytes []byte) (net.HardwareAddr, error)
- func Round(precision int, num float64) float64
- type Database
- type DateTruncater
- type Float64Limiter
- type Int64Limiter
- type IpAddress
- type MacAddress
- type MacAddressInfo
- type NameAttrs
- type NoiseFloat64Limiter
- type NoiseFloat64Transformer
- type NoiseInt64Limiter
- type NoiseInt64Transformer
- type NoiseNumericLimiter
- type NoiseNumericTransformer
- func (nt *NoiseNumericTransformer) GetRequiredGeneratorByteLength() int
- func (nt *NoiseNumericTransformer) SetDynamicLimiter(l *NoiseNumericLimiter) *NoiseNumericTransformer
- func (nt *NoiseNumericTransformer) SetGenerator(g generators.Generator) error
- func (nt *NoiseNumericTransformer) Transform(original decimal.Decimal) (decimal.Decimal, error)
- type NoiseTimestamp
- type NoiseTimestampLimiter
- type PersonDatabase
- type RandomBoolean
- type RandomChoiceTransformer
- type RandomFloat64Transformer
- type RandomInt64Transformer
- type RandomNumericLimiter
- type RandomNumericTransformer
- func (ig *RandomNumericTransformer) GetRequiredGeneratorByteLength() int
- func (ig *RandomNumericTransformer) SetDynamicLimiter(l *RandomNumericLimiter) *RandomNumericTransformer
- func (ig *RandomNumericTransformer) SetGenerator(g generators.Generator) error
- func (ig *RandomNumericTransformer) Transform(original []byte) (decimal.Decimal, error)
- type RandomPersonTransformer
- func (rpt *RandomPersonTransformer) GetDb() *PersonDatabase
- func (rpt *RandomPersonTransformer) GetFullName(gender string, original []byte) (map[string]string, error)
- func (rpt *RandomPersonTransformer) GetRequiredGeneratorByteLength() int
- func (rpt *RandomPersonTransformer) SetGenerator(g generators.Generator) error
- type RandomStringTransformer
- type RandomUuidTransformer
- type Timestamp
- type TimestampLimiter
- type Transformer
Constants ¶
View Source
const ( CastTypeIndividual = iota CastTypeGroup CastTypeAny )
View Source
const ( ManagementTypeUniversal = iota ManagementTypeLocal ManagementTypeAny )
View Source
const ( MaleGenderName = "Male" FemaleGenderName = "Female" AnyGenderName = "Any" )
View Source
const ( RandomFullNameTransformerFullNameMode = iota RandomFullNameTransformerFirstNameMode RandomFullNameTransformerSurnameMode )
View Source
const ( YearTruncateName = "year" MonthTruncateName = "month" DayTruncateName = "day" HourTruncateName = "hour" MinuteTruncateName = "minute" SecondTruncateName = "second" MillisecondTruncateName = "millisecond" MicrosecondTruncateName = "microsecond" NanosecondTruncateName = "nanosecond" )
View Source
const ( YearTruncateValue = iota + 1 MonthTruncateValue DayTruncateValue HourTruncateValue MinuteTruncateValue SecondTruncateValue MillisecondTruncateValue MicrosecondTruncateValue NanosecondTruncateValue )
View Source
const TimestampTransformerByteLength = 16
Variables ¶
View Source
var DefaultDb = NewPersonalDatabase(DefaultPersonMap)
View Source
var DefaultFirstNamesFemale = []string{}/* 1441 elements not displayed */
View Source
var DefaultFirstNamesMale = []string{}/* 1571 elements not displayed */
View Source
var DefaultLastNames = []string{}/* 473 elements not displayed */
View Source
var DefaultPersonMap = map[string]map[string][]string{ MaleGenderName: { "Title": DefaultTitlesMale, "LastName": DefaultLastNames, "FirstName": DefaultFirstNamesMale, }, FemaleGenderName: { "Title": DefaultTitlesFemale, "LastName": DefaultLastNames, "FirstName": DefaultFirstNamesFemale, }, }
View Source
var DefaultTitlesFemale = []string{
"Mrs.", "Ms.", "Miss", "Dr.", "Prof.", "Lady", "Queen", "Princess",
}
View Source
var DefaultTitlesMale = []string{
"Mr.", "Dr.", "Prof.", "Lord", "King", "Prince",
}
View Source
var (
ErrWrongLimits = errors.New("wrong limits")
)
Functions ¶
func ModifyMacAddress ¶
func RandomBytesToHardwareAddr ¶
func RandomBytesToHardwareAddr(originalBytes []byte) (net.HardwareAddr, error)
Types ¶
type DateTruncater ¶
type DateTruncater struct {
// contains filtered or unexported fields
}
func NewDateTruncater ¶
func NewDateTruncater(truncatePartName string) (*DateTruncater, error)
type Float64Limiter ¶
type Float64Limiter struct {
// contains filtered or unexported fields
}
func NewFloat64Limiter ¶
func NewFloat64Limiter(minValue, maxValue float64, precision int) (*Float64Limiter, error)
func (*Float64Limiter) Limit ¶
func (fl *Float64Limiter) Limit(v float64) float64
type Int64Limiter ¶
type Int64Limiter struct { MinValue int64 MaxValue int64 // contains filtered or unexported fields }
func NewInt64Limiter ¶
func NewInt64Limiter(minValue, maxValue int64) (*Int64Limiter, error)
func (*Int64Limiter) Limit ¶
func (l *Int64Limiter) Limit(v uint64) int64
type IpAddress ¶
type IpAddress struct {
// contains filtered or unexported fields
}
func (*IpAddress) GetRequiredGeneratorByteLength ¶
func (*IpAddress) SetGenerator ¶
func (ip *IpAddress) SetGenerator(g generators.Generator) error
type MacAddress ¶
type MacAddress struct {
// contains filtered or unexported fields
}
func NewMacAddress ¶
func NewMacAddress() (*MacAddress, error)
func (*MacAddress) Generate ¶
func (macAddr *MacAddress) Generate(original net.HardwareAddr, keepOriginalVendor bool, castType int, managementType int) (net.HardwareAddr, error)
func (*MacAddress) GetRequiredGeneratorByteLength ¶
func (macAddr *MacAddress) GetRequiredGeneratorByteLength() int
func (*MacAddress) SetGenerator ¶
func (macAddr *MacAddress) SetGenerator(g generators.Generator) error
type MacAddressInfo ¶
type MacAddressInfo struct { MacAddress net.HardwareAddr ManagementType int CastType int }
func ExploreMacAddress ¶
func ExploreMacAddress(macAddress net.HardwareAddr) (*MacAddressInfo, error)
ExploreMacAddress - explore mac address and return info about it
type NoiseFloat64Limiter ¶
func NewNoiseFloat64Limiter ¶
func NewNoiseFloat64Limiter(minVal, maxVal float64, precision int) (*NoiseFloat64Limiter, error)
func (*NoiseFloat64Limiter) Limit ¶
func (ni *NoiseFloat64Limiter) Limit(v float64) float64
type NoiseFloat64Transformer ¶
type NoiseFloat64Transformer struct {
// contains filtered or unexported fields
}
func NewNoiseFloat64Transformer ¶
func NewNoiseFloat64Transformer(limiter *NoiseFloat64Limiter, minRatio, maxRatio float64) *NoiseFloat64Transformer
func (*NoiseFloat64Transformer) GetRequiredGeneratorByteLength ¶
func (nt *NoiseFloat64Transformer) GetRequiredGeneratorByteLength() int
func (*NoiseFloat64Transformer) SetGenerator ¶
func (nt *NoiseFloat64Transformer) SetGenerator(g generators.Generator) error
func (*NoiseFloat64Transformer) Transform ¶
func (nt *NoiseFloat64Transformer) Transform(l *NoiseFloat64Limiter, original float64) (float64, error)
type NoiseInt64Limiter ¶
func NewNoiseInt64Limiter ¶
func NewNoiseInt64Limiter(minVal, maxVal int64) (*NoiseInt64Limiter, error)
func (*NoiseInt64Limiter) Limit ¶
func (ni *NoiseInt64Limiter) Limit(v int64) int64
type NoiseInt64Transformer ¶
type NoiseInt64Transformer struct {
// contains filtered or unexported fields
}
func NewNoiseInt64Transformer ¶
func NewNoiseInt64Transformer(limiter *NoiseInt64Limiter, minRatio, maxRatio float64) (*NoiseInt64Transformer, error)
func (*NoiseInt64Transformer) GetRequiredGeneratorByteLength ¶
func (ig *NoiseInt64Transformer) GetRequiredGeneratorByteLength() int
func (*NoiseInt64Transformer) SetGenerator ¶
func (ig *NoiseInt64Transformer) SetGenerator(g generators.Generator) error
func (*NoiseInt64Transformer) Transform ¶
func (ig *NoiseInt64Transformer) Transform(l *NoiseInt64Limiter, original int64) (int64, error)
type NoiseNumericLimiter ¶
type NoiseNumericLimiter struct { MinValue decimal.Decimal MaxValue decimal.Decimal // contains filtered or unexported fields }
func NewNoiseNumericLimiter ¶
func NewNoiseNumericLimiter(minVal, maxVal decimal.Decimal) (*NoiseNumericLimiter, error)
func (*NoiseNumericLimiter) Limit ¶
func (ni *NoiseNumericLimiter) Limit(v decimal.Decimal) decimal.Decimal
func (*NoiseNumericLimiter) SetPrecision ¶
func (ni *NoiseNumericLimiter) SetPrecision(v int32) *NoiseNumericLimiter
type NoiseNumericTransformer ¶
type NoiseNumericTransformer struct {
// contains filtered or unexported fields
}
func NewNoiseNumericTransformer ¶
func NewNoiseNumericTransformer(limiter *NoiseNumericLimiter, minRatio, maxRatio float64) *NoiseNumericTransformer
func (*NoiseNumericTransformer) GetRequiredGeneratorByteLength ¶
func (nt *NoiseNumericTransformer) GetRequiredGeneratorByteLength() int
func (*NoiseNumericTransformer) SetDynamicLimiter ¶
func (nt *NoiseNumericTransformer) SetDynamicLimiter(l *NoiseNumericLimiter) *NoiseNumericTransformer
SetDynamicLimiter sets the limiter for the dynamic mode. dynamicLimiter will be used set as nil after the Transform call.
func (*NoiseNumericTransformer) SetGenerator ¶
func (nt *NoiseNumericTransformer) SetGenerator(g generators.Generator) error
type NoiseTimestamp ¶
type NoiseTimestamp struct {
// contains filtered or unexported fields
}
func NewNoiseTimestamp ¶
func NewNoiseTimestamp(minRatio, maxRatio time.Duration, truncatePart string, limiter *NoiseTimestampLimiter) (*NoiseTimestamp, error)
func (*NoiseTimestamp) GetRequiredGeneratorByteLength ¶
func (d *NoiseTimestamp) GetRequiredGeneratorByteLength() int
func (*NoiseTimestamp) SetGenerator ¶
func (d *NoiseTimestamp) SetGenerator(g generators.Generator) error
func (*NoiseTimestamp) Transform ¶
func (d *NoiseTimestamp) Transform(l *NoiseTimestampLimiter, v time.Time) (time.Time, error)
type NoiseTimestampLimiter ¶
type NoiseTimestampLimiter struct {
// contains filtered or unexported fields
}
func NewNoiseTimestampLimiter ¶
func NewNoiseTimestampLimiter(minDate, maxDate *time.Time) (*NoiseTimestampLimiter, error)
type PersonDatabase ¶
func NewPersonalDatabase ¶
func NewPersonalDatabase(data Database) *PersonDatabase
func (*PersonDatabase) GetRandomAttribute ¶
func (pd *PersonDatabase) GetRandomAttribute(gender, attr string, randomIdx uint32) string
func (*PersonDatabase) GetRandomGender ¶
func (pd *PersonDatabase) GetRandomGender(randomIdx uint32) string
type RandomBoolean ¶
type RandomBoolean struct {
// contains filtered or unexported fields
}
func NewRandomBoolean ¶
func NewRandomBoolean() *RandomBoolean
func (*RandomBoolean) GetRequiredGeneratorByteLength ¶
func (b *RandomBoolean) GetRequiredGeneratorByteLength() int
func (*RandomBoolean) SetGenerator ¶
func (b *RandomBoolean) SetGenerator(g generators.Generator) error
type RandomChoiceTransformer ¶
type RandomChoiceTransformer struct {
// contains filtered or unexported fields
}
func NewRandomChoiceTransformer ¶
func NewRandomChoiceTransformer(values []*toolkit.RawValue) *RandomChoiceTransformer
func (*RandomChoiceTransformer) GetRequiredGeneratorByteLength ¶
func (rc *RandomChoiceTransformer) GetRequiredGeneratorByteLength() int
func (*RandomChoiceTransformer) SetGenerator ¶
func (rc *RandomChoiceTransformer) SetGenerator(g generators.Generator) error
type RandomFloat64Transformer ¶
type RandomFloat64Transformer struct {
// contains filtered or unexported fields
}
func NewRandomFloat64Transformer ¶
func NewRandomFloat64Transformer(limiter *Float64Limiter) *RandomFloat64Transformer
func (*RandomFloat64Transformer) GetRequiredGeneratorByteLength ¶
func (f *RandomFloat64Transformer) GetRequiredGeneratorByteLength() int
func (*RandomFloat64Transformer) SetGenerator ¶
func (f *RandomFloat64Transformer) SetGenerator(g generators.Generator) error
func (*RandomFloat64Transformer) Transform ¶
func (f *RandomFloat64Transformer) Transform(l *Float64Limiter, original []byte) (float64, error)
type RandomInt64Transformer ¶
type RandomInt64Transformer struct {
// contains filtered or unexported fields
}
func NewRandomInt64Transformer ¶
func NewRandomInt64Transformer(limiter *Int64Limiter, size int) (*RandomInt64Transformer, error)
func (*RandomInt64Transformer) GetRequiredGeneratorByteLength ¶
func (ig *RandomInt64Transformer) GetRequiredGeneratorByteLength() int
func (*RandomInt64Transformer) SetGenerator ¶
func (ig *RandomInt64Transformer) SetGenerator(g generators.Generator) error
func (*RandomInt64Transformer) Transform ¶
func (ig *RandomInt64Transformer) Transform(l *Int64Limiter, original []byte) (int64, error)
type RandomNumericLimiter ¶
type RandomNumericLimiter struct { MinValue decimal.Decimal MaxValue decimal.Decimal // contains filtered or unexported fields }
func NewRandomNumericLimiter ¶
func NewRandomNumericLimiter(minValue, maxValue decimal.Decimal) (*RandomNumericLimiter, error)
func NewRandomNumericLimiterFromSize ¶
func NewRandomNumericLimiterFromSize(digitsBeforeDecimal int) (*RandomNumericLimiter, error)
func (*RandomNumericLimiter) ByteLength ¶
func (l *RandomNumericLimiter) ByteLength() int
func (*RandomNumericLimiter) Limit ¶
func (l *RandomNumericLimiter) Limit(v decimal.Decimal) decimal.Decimal
func (*RandomNumericLimiter) SetPrecision ¶
func (l *RandomNumericLimiter) SetPrecision(v int32)
type RandomNumericTransformer ¶
type RandomNumericTransformer struct {
// contains filtered or unexported fields
}
func NewRandomNumericTransformer ¶
func NewRandomNumericTransformer(limiter *RandomNumericLimiter, precision int32) (*RandomNumericTransformer, error)
func (*RandomNumericTransformer) GetRequiredGeneratorByteLength ¶
func (ig *RandomNumericTransformer) GetRequiredGeneratorByteLength() int
func (*RandomNumericTransformer) SetDynamicLimiter ¶
func (ig *RandomNumericTransformer) SetDynamicLimiter(l *RandomNumericLimiter) *RandomNumericTransformer
SetDynamicLimiter sets the limiter for the dynamic mode. dynamicLimiter will be used set as nil after the Transform call.
func (*RandomNumericTransformer) SetGenerator ¶
func (ig *RandomNumericTransformer) SetGenerator(g generators.Generator) error
type RandomPersonTransformer ¶
type RandomPersonTransformer struct {
// contains filtered or unexported fields
}
func NewRandomPersonTransformer ¶
func NewRandomPersonTransformer(gender string, personDb Database) *RandomPersonTransformer
func (*RandomPersonTransformer) GetDb ¶
func (rpt *RandomPersonTransformer) GetDb() *PersonDatabase
func (*RandomPersonTransformer) GetFullName ¶
func (*RandomPersonTransformer) GetRequiredGeneratorByteLength ¶
func (rpt *RandomPersonTransformer) GetRequiredGeneratorByteLength() int
func (*RandomPersonTransformer) SetGenerator ¶
func (rpt *RandomPersonTransformer) SetGenerator(g generators.Generator) error
type RandomStringTransformer ¶
type RandomStringTransformer struct {
// contains filtered or unexported fields
}
func NewRandomStringTransformer ¶
func NewRandomStringTransformer(chars []rune, minLength, maxLength int) (*RandomStringTransformer, error)
func (*RandomStringTransformer) GetRequiredGeneratorByteLength ¶
func (st *RandomStringTransformer) GetRequiredGeneratorByteLength() int
func (*RandomStringTransformer) SetGenerator ¶
func (st *RandomStringTransformer) SetGenerator(g generators.Generator) error
func (*RandomStringTransformer) Transform ¶
func (st *RandomStringTransformer) Transform(data []byte) []rune
type RandomUuidTransformer ¶
type RandomUuidTransformer struct {
// contains filtered or unexported fields
}
func NewRandomUuidTransformer ¶
func NewRandomUuidTransformer() *RandomUuidTransformer
func (*RandomUuidTransformer) GetRequiredGeneratorByteLength ¶
func (ut *RandomUuidTransformer) GetRequiredGeneratorByteLength() int
func (*RandomUuidTransformer) SetGenerator ¶
func (ut *RandomUuidTransformer) SetGenerator(g generators.Generator) error
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
func NewRandomTimestamp ¶
func NewRandomTimestamp(truncatePart string, limiter *TimestampLimiter) (*Timestamp, error)
func (*Timestamp) GetRequiredGeneratorByteLength ¶
func (*Timestamp) SetGenerator ¶
func (d *Timestamp) SetGenerator(g generators.Generator) error
type TimestampLimiter ¶
type TimestampLimiter struct {
// contains filtered or unexported fields
}
func NewTimestampLimiter ¶
func NewTimestampLimiter(minDate, maxDate time.Time) (*TimestampLimiter, error)
type Transformer ¶
type Transformer interface { GetRequiredGeneratorByteLength() int SetGenerator(g generators.Generator) error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.