Documentation ¶
Index ¶
- func FormatDigits(s string) string
- func GetYaml(lc string) ([]byte, error)
- func GetYamlPath(lc string) string
- type AddressData
- type AddressGenerator
- func (ag *AddressGenerator) City() string
- func (ag *AddressGenerator) Country() string
- func (ag *AddressGenerator) CountryCode() string
- func (ag *AddressGenerator) Full() string
- func (ag *AddressGenerator) Number() string
- func (ag *AddressGenerator) Province() string
- func (ag *AddressGenerator) Secondary() string
- func (ag *AddressGenerator) SetLocale(lc string) error
- func (ag *AddressGenerator) State() string
- func (ag *AddressGenerator) Street() string
- func (ag *AddressGenerator) StreetPrefix() string
- func (ag *AddressGenerator) StreetSuffix() string
- func (ag *AddressGenerator) ZipCode() string
- type CompanyData
- type CompanyGenerator
- type MiscGenerator
- func (mg *MiscGenerator) Md5() string
- func (mg *MiscGenerator) RandomFloat32() float32
- func (mg *MiscGenerator) RandomFloat64() float64
- func (mg *MiscGenerator) RandomInt() int
- func (mg *MiscGenerator) RandomIntBelow(t int) int
- func (mg *MiscGenerator) Sha1() string
- func (mg *MiscGenerator) Sha256() string
- func (mg *MiscGenerator) UnixTime() int64
- type PersonData
- type PersonGenerator
- type PhoneData
- type PhoneGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDigits ¶
Helper function that returns all the appearances of "#" for a random digit 0-9
func GetYamlPath ¶
Types ¶
type AddressData ¶
type AddressData struct { Address struct { City []string `yaml:"city"` Country []string `yaml:"country"` CountryCode string `yaml:"country_code"` CountryDefault string `yaml:"country_default"` Number []string `yaml:"number"` StreetSuffix []string `yaml:"street_suffix"` StreetPrefix []string `yaml:"street_prefix"` StreetName []string `yaml:"street_name"` Secondary []string `yaml:"secondary_address"` ZipCode string `yaml:"zip"` Province []string `yaml:"province"` State []string `yaml:"state"` Formatters []string `yaml:"formatters"` } }
AddressData is the struct for the address YAML data
type AddressGenerator ¶
type AddressGenerator struct { // Whether use random formatter for full address all the time or not RandomFormatter bool // Selected formatter (only if `randomFormatter` is false) SelectedFormatter string // contains filtered or unexported fields }
AddressGenerator is the Generator for Addresses. It can return a fully address within the supported formats or just the part of the Address needed
func (*AddressGenerator) Country ¶
func (ag *AddressGenerator) Country() string
Get a random Country name
func (*AddressGenerator) CountryCode ¶
func (ag *AddressGenerator) CountryCode() string
Get a random Country code
func (*AddressGenerator) Full ¶
func (ag *AddressGenerator) Full() string
Get Full address using a formatter
func (*AddressGenerator) Number ¶
func (ag *AddressGenerator) Number() string
Get a random number using the formatter
func (*AddressGenerator) Province ¶
func (ag *AddressGenerator) Province() string
func (*AddressGenerator) Secondary ¶
func (ag *AddressGenerator) Secondary() string
Get a random secondary address field
func (*AddressGenerator) SetLocale ¶
func (ag *AddressGenerator) SetLocale(lc string) error
Supply the formatter with the right data using a locale. By default en_US
func (*AddressGenerator) Street ¶
func (ag *AddressGenerator) Street() string
Get a random Street name
func (*AddressGenerator) StreetPrefix ¶
func (ag *AddressGenerator) StreetPrefix() string
Get a random street prefix
func (*AddressGenerator) StreetSuffix ¶
func (ag *AddressGenerator) StreetSuffix() string
Get a random street suffix
func (*AddressGenerator) ZipCode ¶
func (ag *AddressGenerator) ZipCode() string
Get a random zip code using the digits formatter
type CompanyData ¶
type CompanyData struct { Company struct { Suffix []string `yaml:"suffix"` Buzzwords [][]string `yaml:"buzzwords"` Industry []string `yaml:"industry"` Profession []string `yaml:"profession"` Formatters []string `yaml:"formatters"` } }
CompanyData is the struct with the company YAML data
type CompanyGenerator ¶
type CompanyGenerator struct {
// contains filtered or unexported fields
}
type MiscGenerator ¶
type MiscGenerator struct{}
Misc Generator. Generates random basic data that does not require locale configuration.
func (*MiscGenerator) Md5 ¶
func (mg *MiscGenerator) Md5() string
Hash a random string of 50 characters using md5.
func (*MiscGenerator) RandomFloat32 ¶
func (mg *MiscGenerator) RandomFloat32() float32
func (*MiscGenerator) RandomFloat64 ¶
func (mg *MiscGenerator) RandomFloat64() float64
func (*MiscGenerator) RandomInt ¶
func (mg *MiscGenerator) RandomInt() int
func (*MiscGenerator) RandomIntBelow ¶
func (mg *MiscGenerator) RandomIntBelow(t int) int
func (*MiscGenerator) Sha1 ¶
func (mg *MiscGenerator) Sha1() string
Hash a random string of 50 characters using sha1.
func (*MiscGenerator) Sha256 ¶
func (mg *MiscGenerator) Sha256() string
Hash a random string of 50 characters using sha256.
func (*MiscGenerator) UnixTime ¶
func (mg *MiscGenerator) UnixTime() int64
type PersonData ¶
type PersonData struct { Person struct { FirstName []string `yaml:"first_name"` MiddleName []string `yaml:"middle_name"` LastName []string `yaml:"last_name"` Age []string `yaml:"age"` Formatters []string `yaml:"formatters"` } }
PersonData is the struct for the person YAML data
type PersonGenerator ¶
type PersonGenerator struct { // Whether use random formatter for full person name all the time or not RandomFormatter bool // SelectedFormatter (only if `randomFormatter` is false) SelectedFormatter string // contains filtered or unexported fields }
PersonGenerator is the Generator for People.
func (*PersonGenerator) FirstName ¶
func (pg *PersonGenerator) FirstName() string
Get person First Name
func (*PersonGenerator) FullName ¶
func (pg *PersonGenerator) FullName() string
Get a full name using a formatter
func (*PersonGenerator) LastName ¶
func (pg *PersonGenerator) LastName() string
Get person Last Name
func (*PersonGenerator) MiddleName ¶
func (pg *PersonGenerator) MiddleName() string
Get person Middle Name
func (*PersonGenerator) SetLocale ¶
func (pg *PersonGenerator) SetLocale(lc string) error
Supply the formatter with the right data using a locale. By default en_US
type PhoneData ¶
type PhoneData struct { Phone struct { Formatters []string `yaml:"formatters"` } }
PhoneData is the struct with the company YAML data
type PhoneGenerator ¶
type PhoneGenerator struct { // Whether use random formatter for full person name all the time or not RandomFormatter bool // SelectedFormatter (only if `randomFormatter` is false) SelectedFormatter string // contains filtered or unexported fields }
PhoneGenerator the generator for phone numbers
func (*PhoneGenerator) PhoneNumber ¶
func (pg *PhoneGenerator) PhoneNumber() string
PhoneNumber returns a phone number
func (*PhoneGenerator) SetLocale ¶
func (pg *PhoneGenerator) SetLocale(lc string) error
SetLocale sets the locale for the generator