Documentation
ΒΆ
Index ΒΆ
- Constants
- Variables
- type Fake
- func (f *Fake) Brand() string
- func (f *Fake) Character() string
- func (f *Fake) Characters() string
- func (f *Fake) CharactersN(n int) string
- func (f *Fake) City() string
- func (f *Fake) Color() string
- func (f *Fake) Company() string
- func (f *Fake) Continent() string
- func (f *Fake) Country() string
- func (f *Fake) CreditCardNum(vendor string) string
- func (f *Fake) CreditCardType() string
- func (f *Fake) Currency() string
- func (f *Fake) CurrencyCode() string
- func (f *Fake) Day() int
- func (f *Fake) Digits() string
- func (f *Fake) DigitsN(n int) string
- func (f *Fake) DomainName() string
- func (f *Fake) DomainZone() string
- func (f *Fake) EmailAddress() string
- func (f *Fake) EmailBody() string
- func (f *Fake) EmailSubject() string
- func (f *Fake) EnFallback(flag bool)
- func (f *Fake) FemaleFirstName() string
- func (f *Fake) FemaleFullName() string
- func (f *Fake) FemaleFullNameWithPrefix() string
- func (f *Fake) FemaleFullNameWithSuffix() string
- func (f *Fake) FemaleLastName() string
- func (f *Fake) FemalePatronymic() string
- func (f *Fake) FirstName() string
- func (f *Fake) FullName() string
- func (f *Fake) FullNameWithPrefix() string
- func (f *Fake) FullNameWithSuffix() string
- func (f *Fake) Gender() string
- func (f *Fake) GenderAbbrev() string
- func (f *Fake) GetLangs() []string
- func (f *Fake) HexColor() string
- func (f *Fake) HexColorShort() string
- func (f *Fake) IPv4() string
- func (f *Fake) IPv6() string
- func (f *Fake) Industry() string
- func (f *Fake) JobTitle() string
- func (f *Fake) Language() string
- func (f *Fake) LastName() string
- func (f *Fake) Latitude() float32
- func (f *Fake) LatitudeDegrees() int
- func (f *Fake) LatitudeDirection() string
- func (f *Fake) LatitudeMinutes() int
- func (f *Fake) LatitudeSeconds() int
- func (f *Fake) Longitude() float32
- func (f *Fake) LongitudeDegrees() int
- func (f *Fake) LongitudeDirection() string
- func (f *Fake) LongitudeMinutes() int
- func (f *Fake) LongitudeSeconds() int
- func (f *Fake) MaleFirstName() string
- func (f *Fake) MaleFullName() string
- func (f *Fake) MaleFullNameWithPrefix() string
- func (f *Fake) MaleFullNameWithSuffix() string
- func (f *Fake) MaleLastName() string
- func (f *Fake) MalePatronymic() string
- func (f *Fake) Model() string
- func (f *Fake) Month() string
- func (f *Fake) MonthNum() int
- func (f *Fake) MonthShort() string
- func (f *Fake) Paragraph() string
- func (f *Fake) Paragraphs() string
- func (f *Fake) ParagraphsN(n int) string
- func (f *Fake) Password(atLeast, atMost int, allowUpper, allowNumeric, allowSpecial bool) string
- func (f *Fake) Patronymic() string
- func (f *Fake) Phone() string
- func (f *Fake) Phonef(format string) string
- func (f *Fake) Product() string
- func (f *Fake) ProductName() string
- func (f *Fake) Seed(seed int64)
- func (f *Fake) Sentence() string
- func (f *Fake) Sentences() string
- func (f *Fake) SentencesN(n int) string
- func (f *Fake) SetLang(newLang string) error
- func (f *Fake) SimplePassword() string
- func (f *Fake) State() string
- func (f *Fake) StateAbbrev() string
- func (f *Fake) Street() string
- func (f *Fake) StreetAddress() string
- func (f *Fake) Title() string
- func (f *Fake) TopLevelDomain() string
- func (f *Fake) UseExternalFS(fs fs.FS)
- func (f *Fake) UserName() string
- func (f *Fake) WeekDay() string
- func (f *Fake) WeekDayShort() string
- func (f *Fake) WeekdayNum() int
- func (f *Fake) Word() string
- func (f *Fake) Words() string
- func (f *Fake) WordsN(n int) string
- func (f *Fake) Year(from, to int) int
- func (f *Fake) Zip() string
Constants ΒΆ
const ( LangEnglish = "en" LangRussian = "ru" )
const ( DefaultPasswordMinLength = 6 DefaultPasswordMaxLength = 12 HexColorLength = 6 HexColorShortLength = 3 )
Variables ΒΆ
var ( // ErrNoLanguageFn is the error that indicates that given language is not available ErrNoLanguageFn = func(lang string) error { return fmt.Errorf("language passed (%s) is not available", lang) } // ErrNoSamplesFn is the error that indicates that there are no samples for the given language ErrNoSamplesFn = func(lang string) error { return fmt.Errorf("no samples found for language: %s", lang) } )
Functions ΒΆ
This section is empty.
Types ΒΆ
type Fake ΒΆ
type Fake struct {
// contains filtered or unexported fields
}
func (*Fake) Characters ΒΆ
Characters generates from 1 to 5 characters in the given language
func (*Fake) CharactersN ΒΆ
CharactersN generates n random characters in the given language
func (*Fake) CreditCardNum ΒΆ
CreditCardNum generated credit card number according to the card number rules
func (*Fake) CreditCardType ΒΆ
CreditCardType returns one of the following credit values: VISA, MasterCard, American Express and Discover
func (*Fake) CurrencyCode ΒΆ
CurrencyCode generates currency code
func (*Fake) DomainName ΒΆ
DomainName generates random domain name
func (*Fake) DomainZone ΒΆ
DomainZone generates random domain zone
func (*Fake) EmailAddress ΒΆ
EmailAddress generates email address
func (*Fake) EmailSubject ΒΆ
EmailSubject generates random email subject
func (*Fake) EnFallback ΒΆ
EnFallback sets the flag that allows fake to fallback to englsh samples if the ones for the used languaged are not available
func (*Fake) FemaleFirstName ΒΆ
FemaleFirstName generates female first name
func (*Fake) FemaleFullName ΒΆ
FemaleFullName generates female full name it can occasionally include prefix or suffix
func (*Fake) FemaleFullNameWithPrefix ΒΆ
FemaleFullNameWithPrefix generates prefixed female full name if prefixes for the given language are available
func (*Fake) FemaleFullNameWithSuffix ΒΆ
FemaleFullNameWithSuffix generates suffixed female full name if suffixes for the given language are available
func (*Fake) FemaleLastName ΒΆ
FemaleLastName generates female last name
func (*Fake) FemalePatronymic ΒΆ
FemalePatronymic generates female patronymic
func (*Fake) FullNameWithPrefix ΒΆ
FullNameWithPrefix generates prefixed full name if prefixes for the given language are available
func (*Fake) FullNameWithSuffix ΒΆ
FullNameWithSuffix generates suffixed full name if suffixes for the given language are available
func (*Fake) GenderAbbrev ΒΆ
GenderAbbrev returns first downcased letter of the random gender
func (*Fake) GetLangs ΒΆ added in v0.1.2
GetLangs returns a slice of available languages from the embedded data FS.
func (*Fake) HexColorShort ΒΆ
HexColorShort generates short hex color name
func (*Fake) LatitudeDegrees ΒΆ
LatitudeDegrees generates latitude degrees (from -90 to 90)
func (*Fake) LatitudeDirection ΒΆ
LatitudeDirection generates latitude direction (N(orth) o S(outh))
func (*Fake) LatitudeMinutes ΒΆ
LatitudeMinutes generates latitude minutes (from 0 to 60)
func (*Fake) LatitudeSeconds ΒΆ
LatitudeSeconds generates latitude seconds (from 0 to 60)
func (*Fake) LongitudeDegrees ΒΆ
LongitudeDegrees generates longitude degrees (from -180 to 180)
func (*Fake) LongitudeDirection ΒΆ
LongitudeDirection generates (W(est) or E(ast))
func (*Fake) LongitudeMinutes ΒΆ
LongitudeMinutes generates (from 0 to 60)
func (*Fake) LongitudeSeconds ΒΆ
LongitudeSeconds generates (from 0 to 60)
func (*Fake) MaleFirstName ΒΆ
MaleFirstName generates male first name
func (*Fake) MaleFullName ΒΆ
MaleFullName generates male full name it can occasionally include prefix or suffix
func (*Fake) MaleFullNameWithPrefix ΒΆ
MaleFullNameWithPrefix generates prefixed male full name if prefixes for the given language are available
func (*Fake) MaleFullNameWithSuffix ΒΆ
MaleFullNameWithSuffix generates suffixed male full name if suffixes for the given language are available
func (*Fake) MaleLastName ΒΆ
MaleLastName generates male last name
func (*Fake) MalePatronymic ΒΆ
MalePatronymic generates male patronymic
func (*Fake) Model ΒΆ
Model generates model name that consists of letters and digits, optionally with a hyphen between them
func (*Fake) MonthShort ΒΆ
MonthShort generates abbreviated month name
func (*Fake) Paragraphs ΒΆ
Paragraphs generates from 1 to 5 paragraphs
func (*Fake) ParagraphsN ΒΆ
ParagraphsN generates n paragraphs
func (*Fake) Password ΒΆ
Password generates password with the length from atLeast to atMost characters, allow* parameters specify whether corresponding symbols can be used
Example:
f := fake.New() password := f.Password(8, 16, true, true, true) // Generates password like "Abc123!@"
func (*Fake) Phone ΒΆ
Phone generates random phone number using one of the formats format specified in phone_format file
func (*Fake) Phonef ΒΆ added in v0.1.11
Phonef generates random phone number using format like #-###-###-##-##
func (*Fake) Seed ΒΆ
Seed uses the provided seed value to initialize the internal PRNG to a deterministic state.
func (*Fake) SentencesN ΒΆ
SentencesN generates n random sentences
func (*Fake) SetLang ΒΆ
SetLang sets the language in which the data should be generated returns error if passed language is not available
func (*Fake) SimplePassword ΒΆ
SimplePassword is a wrapper around Password, it generates password with the length from 6 to 12 symbols, with upper characters and numeric symbols allowed
func (*Fake) StateAbbrev ΒΆ
StateAbbrev generates random state abbreviation
func (*Fake) StreetAddress ΒΆ
StreetAddress generates random street name along with building number
func (*Fake) TopLevelDomain ΒΆ
TopLevelDomain generates random top level domain
func (*Fake) UseExternalFS ΒΆ added in v0.1.2
func (*Fake) UserName ΒΆ
UserName generates user name in one of the following forms first name + last name, letter + last names or concatenation of from 1 to 3 lowercased words
func (*Fake) WeekDayShort ΒΆ
WeekDayShort generates abbreviated name of the week day
func (*Fake) WeekdayNum ΒΆ
WeekdayNum generates number of the day of the week