Documentation ¶
Index ¶
- func InArray(val interface{}, array interface{}) int
- type Builder
- type CompanyProvider
- type DNAProvider
- type Fake
- func (f Fake) BuzzPhrase() string
- func (f Fake) CatchPhrase() string
- func (f Fake) ChangeDNAProvider(d DNAProvider)
- func (f Fake) ChangeInternetProvider(i InternetProvider)
- func (f Fake) ChangeLoremProvider(l LoremProvider)
- func (f Fake) ChangePersonProvider(p PersonProvider)
- func (f Fake) ChangeTextProvider(t TextProvider)
- func (f Fake) Company() string
- func (f Fake) CompanyEmail() string
- func (f Fake) DNASequence(len int) (string, error)
- func (f *Fake) Deterministic(seed int64)
- func (f Fake) DomainName() string
- func (f Fake) EIN() string
- func (f Fake) Email() string
- func (f Fake) Factory(builder Builder, n int) []any
- func (f Fake) FirstName() string
- func (f Fake) FirstNameFemale() string
- func (f Fake) FirstNameMale() string
- func (f Fake) FreeEmail() string
- func (f Fake) Gender() string
- func (f Fake) IPv4() string
- func (f Fake) IPv6() string
- func (f Fake) Image(img ImageSettings) (image.Image, error)
- func (f Fake) ImageUrl(img ImageSettings) (string, error)
- func (f Fake) JobTitle() string
- func (f Fake) LastName() string
- func (f Fake) MacAddress() string
- func (f Fake) Name() string
- func (f *Fake) Nondeterministic()
- func (f Fake) Paragraph(sentenceCount int) string
- func (f Fake) RealText(maxWordCount int, prefixLen int) (string, error)
- func (f Fake) SafeEmail() string
- func (f Fake) Sentence(wordCount int) string
- func (f Fake) Suffix() string
- func (f Fake) Title() string
- func (f Fake) TitleFemale() string
- func (f Fake) TitleMale() string
- func (f Fake) Url() string
- func (f Fake) Username() string
- func (f Fake) Word() string
- type ImageProvider
- type ImageSettings
- type InternetProvider
- type LoremProvider
- type PersonProvider
- type TextProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompanyProvider ¶ added in v0.0.3
type CompanyProvider interface { NameFormats() []string Suffixes() []string CatchWords() [][]string BuzzWords() [][]string JobTitles() []string EIN(rand1, rand2 int) string }
CompanyProvider must be implemented to provide all data for company related fake data generation
type DNAProvider ¶
type DNAProvider interface {
Set() []string
}
DNAProvider must be implemented to provide different sets of data for DNA sequence generation
type Fake ¶
type Fake struct {
// contains filtered or unexported fields
}
Fake is the main type for faking data
func (Fake) BuzzPhrase ¶ added in v0.0.3
BuzzPhrase generates random phrase with buzz words
func (Fake) CatchPhrase ¶ added in v0.0.3
CatchPhrase builds a random catch phrase from source
func (Fake) ChangeDNAProvider ¶
func (f Fake) ChangeDNAProvider(d DNAProvider)
ChangeDNAProvider changes the data provider for DNA sequence related fake data generation
func (Fake) ChangeInternetProvider ¶
func (f Fake) ChangeInternetProvider(i InternetProvider)
ChangeInternetProvider changes the data provider for internet related fake data generation
func (Fake) ChangeLoremProvider ¶
func (f Fake) ChangeLoremProvider(l LoremProvider)
ChangeLoremProvider changes the data provider for lorem (dummy text) related fake data generation
func (Fake) ChangePersonProvider ¶
func (f Fake) ChangePersonProvider(p PersonProvider)
ChangePersonProvider changes the data provider for person related fake data generation
func (Fake) ChangeTextProvider ¶
func (f Fake) ChangeTextProvider(t TextProvider)
ChangeTextProvider changes the data provider for text related fake data generation
func (Fake) CompanyEmail ¶
CompanyEmail returns a random "company" email address
func (Fake) DNASequence ¶
DNASequence generates a simplified random DNA sequence of the given len
func (*Fake) Deterministic ¶ added in v0.0.4
Deterministic will make the generated values constant until a call to Nondeterministic
func (Fake) FirstNameFemale ¶
FirstNameFemale returns a random female first name
func (Fake) FirstNameMale ¶
FirstNameMale gets a first name male randomly
func (Fake) Image ¶ added in v0.0.3
func (f Fake) Image(img ImageSettings) (image.Image, error)
Image returns a random image.Image
func (Fake) ImageUrl ¶ added in v0.0.3
func (f Fake) ImageUrl(img ImageSettings) (string, error)
ImageUrl returns a random image url
func (Fake) MacAddress ¶
MacAddress get mac address randomly in string
func (*Fake) Nondeterministic ¶ added in v0.0.4
func (f *Fake) Nondeterministic()
Nondeterministic reset the seed to it's default randomness for each generated value
func (Fake) RealText ¶
RealText generates a text string by the Markov chain algorithm.
Depending on the maxWordCount, returns a random valid looking text. The algorithm generates a weighted table with the specified number of words as the index and the possible following words as the value.// @example 'Alice, swallowing down her flamingo, and began by taking the little golden key' maxWordCount is the maximum number of characters the text should contain (minimum: 10) prefixLen determines how many words are considered for the generation of the next word. The minimum is 1, and it produces a higher level of randomness, although the generated text usually doesn't make sense. Higher index sizes (up to 5) produce more correct text, at the price of less randomness. @return string
func (Fake) TitleFemale ¶
TitleFemale get a title female randomly
type ImageProvider ¶ added in v0.0.3
type ImageProvider interface { // ImgSource default is lorempixel.com ImgSource() string // Categories is the list of valid categories for the default image source - LoremPixel Categories() []string }
ImageProvider must be implemented by types that wants to provide data source for images.
type ImageSettings ¶ added in v0.0.3
ImageSettings provide settings for random image
type InternetProvider ¶
type InternetProvider interface { FreeEmailDomains() []string SafeEmailDomains() []string Tld() []string UserNameFormats() []string EmailFormats() []string UrlFormats() []string }
InternetProvider must be implemented by types that wants to provide data source for emails, URLs, etc.
type LoremProvider ¶
type LoremProvider interface {
Words() []string
}
LoremProvider must be implemented by types that wants to provide data source for emails, URLs, etc.
type PersonProvider ¶
type PersonProvider interface { TitlesMale() []string TitlesFemale() []string FirstNames() []string FirstNamesMale() []string FirstNamesFemale() []string LastNames() []string Genders() []string Suffixes() []string }
PersonProvider must be implemented by types that wants to provide data source for names, etc.
type TextProvider ¶
type TextProvider interface {
Source() string
}
TextProvider must be implemented by types that wants to provide data source for texts