Documentation ¶
Index ¶
- Constants
- func Build(replace []byte) (map[string]Replacer, error)
- func GetRandomChinaCellPhoneNo(g *rng.GaussianGenerator) string
- func GetRandomChinaIP(g *rng.GaussianGenerator) string
- func GetRandomChineseName(g *rng.GaussianGenerator) string
- func GetRandomString(chars string, length int) string
- func GetRandomUUID() string
- func InitLooksRealParms(parms map[string]interface{}, t string)
- func RandomJSON(maxDepth int, maxElements int, seed []string) string
- func RandomXML(maxDepth int, maxElements int, seed []string) string
- func SimpleGaussian(g *rng.GaussianGenerator, gap int) int
- type FixedListReplacer
- type FloatReplacer
- type IntegerReplacer
- type LooksReal
- type Replacer
- func NewFixedListReplacer(c string, v []string, ci int) Replacer
- func NewFloatReplacer(min float64, max float64, precision int64) Replacer
- func NewIntegerReplacer(c string, minV int64, maxV int64, cv int64) Replacer
- func NewLooksReal(m string, p map[string]interface{}) Replacer
- func NewStringReplacer(chars string, min int64, max int64) Replacer
- func NewTimeStampReplacer(f string) Replacer
- type StringReplacer
- type TimeStampReplacer
Constants ¶
const ( IPV4 = "ipv4" IPV4CHINA = "ipv4China" CELLPHONECHINA = "cellphoneChina" IPV6 = "ipv6" MAC = "mac" UA = "userAgent" COUNTRY = "country" EMAIL = "email" NAME = "name" CHINESENAME = "chineseName" UUID = "uuid" XML = "xml" JSON = "json" )
LooksReal data methods
const ( NEXT = "next" PREV = "prev" RANDOM = "random" )
Value selection method
const ( MAXDEPTH = "maxDepth" MAXELEMENTS = "maxElements" TAGSEED = "tagSeed" )
Looks-real opts
Variables ¶
This section is empty.
Functions ¶
func GetRandomChinaCellPhoneNo ¶
func GetRandomChinaCellPhoneNo(g *rng.GaussianGenerator) string
GetRandomChinaCellPhoneNo returns a random cell phone number starts with 130 - 139
func GetRandomChinaIP ¶
func GetRandomChinaIP(g *rng.GaussianGenerator) string
GetRandomChinaIP returns a random IP address of China.
func GetRandomChineseName ¶
func GetRandomChineseName(g *rng.GaussianGenerator) string
GetRandomChineseName generates random (in gaussian distribution) Chinese name picked from the seed.
func GetRandomString ¶
GetRandomString generates a random string of length n.
func InitLooksRealParms ¶
InitLooksRealParms initiate the parameters map with the default values
func RandomJSON ¶
RandomJSON returns a randomly generated JSON doc in string format.
func SimpleGaussian ¶
SimpleGaussian returns a random value of Gaussian distribution. mean=0.5*the_range, stddev=0.2*the_range
Types ¶
type FixedListReplacer ¶
type FixedListReplacer struct {
// contains filtered or unexported fields
}
FixedListReplacer is a struct to record config opts of a fixed-list replacement type.
func (*FixedListReplacer) ReplacedValue ¶
func (fl *FixedListReplacer) ReplacedValue(g *rng.GaussianGenerator) (string, error)
ReplacedValue returns a new replacement value of fixed-list type.
type FloatReplacer ¶
type FloatReplacer struct {
// contains filtered or unexported fields
}
func (*FloatReplacer) ReplacedValue ¶
func (f *FloatReplacer) ReplacedValue(g *rng.GaussianGenerator) (string, error)
type IntegerReplacer ¶
type IntegerReplacer struct {
// contains filtered or unexported fields
}
func (*IntegerReplacer) ReplacedValue ¶
func (i *IntegerReplacer) ReplacedValue(g *rng.GaussianGenerator) (string, error)
ReplacedValue is the main function to populate replacement value of an integer type.
type LooksReal ¶
type LooksReal struct {
// contains filtered or unexported fields
}
LooksReal is a struct to record the configured method to generate data.
func (*LooksReal) ReplacedValue ¶
ReplacedValue returns random data based on the data type selection.
type Replacer ¶
type Replacer interface { // ReplacedValue returns the new replaced value. ReplacedValue(*rng.GaussianGenerator) (string, error) }
Replacer is the interface which must be implemented by a particular replacement policy.
func NewFixedListReplacer ¶
NewFixedListReplacer returns a new FixedListReplacer struct instance
func NewIntegerReplacer ¶
NewIntegerReplacer returns a new IntegerReplacer struct instance
func NewLooksReal ¶
NewLooksReal returns a new LooksReal struct instance
func NewTimeStampReplacer ¶
NewTimeStampReplacer returns a new TimeStampReplacer struct instance.
type StringReplacer ¶
type StringReplacer struct {
// contains filtered or unexported fields
}
func (*StringReplacer) ReplacedValue ¶
func (s *StringReplacer) ReplacedValue(g *rng.GaussianGenerator) (string, error)
type TimeStampReplacer ¶
type TimeStampReplacer struct {
// contains filtered or unexported fields
}
func (*TimeStampReplacer) ReplacedValue ¶
func (ts *TimeStampReplacer) ReplacedValue(*rng.GaussianGenerator) (string, error)
ReplacedValue populates a new timestamp with current time.