names.go

  1package fake
  2
  3func randGender() string {
  4	g := "male"
  5	if r.Intn(2) == 0 {
  6		g = "female"
  7	}
  8	return g
  9}
 10
 11func firstName(gender string) string {
 12	return lookup(lang, gender+"_first_names", true)
 13}
 14
 15// MaleFirstName generates male first name
 16func MaleFirstName() string {
 17	return firstName("male")
 18}
 19
 20// FemaleFirstName generates female first name
 21func FemaleFirstName() string {
 22	return firstName("female")
 23}
 24
 25// FirstName generates first name
 26func FirstName() string {
 27	return firstName(randGender())
 28}
 29
 30func lastName(gender string) string {
 31	return lookup(lang, gender+"_last_names", true)
 32}
 33
 34// MaleLastName generates male last name
 35func MaleLastName() string {
 36	return lastName("male")
 37}
 38
 39// FemaleLastName generates female last name
 40func FemaleLastName() string {
 41	return lastName("female")
 42}
 43
 44// LastName generates last name
 45func LastName() string {
 46	return lastName(randGender())
 47}
 48
 49func patronymic(gender string) string {
 50	return lookup(lang, gender+"_patronymics", false)
 51}
 52
 53// MalePatronymic generates male patronymic
 54func MalePatronymic() string {
 55	return patronymic("male")
 56}
 57
 58// FemalePatronymic generates female patronymic
 59func FemalePatronymic() string {
 60	return patronymic("female")
 61}
 62
 63// Patronymic generates patronymic
 64func Patronymic() string {
 65	return patronymic(randGender())
 66}
 67
 68func prefix(gender string) string {
 69	return lookup(lang, gender+"_name_prefixes", false)
 70}
 71
 72func suffix(gender string) string {
 73	return lookup(lang, gender+"_name_suffixes", false)
 74}
 75
 76func fullNameWithPrefix(gender string) string {
 77	return join(prefix(gender), firstName(gender), lastName(gender))
 78}
 79
 80// MaleFullNameWithPrefix generates prefixed male full name
 81// if prefixes for the given language are available
 82func MaleFullNameWithPrefix() string {
 83	return fullNameWithPrefix("male")
 84}
 85
 86// FemaleFullNameWithPrefix generates prefixed female full name
 87// if prefixes for the given language are available
 88func FemaleFullNameWithPrefix() string {
 89	return fullNameWithPrefix("female")
 90}
 91
 92// FullNameWithPrefix generates prefixed full name
 93// if prefixes for the given language are available
 94func FullNameWithPrefix() string {
 95	return fullNameWithPrefix(randGender())
 96}
 97
 98func fullNameWithSuffix(gender string) string {
 99	return join(firstName(gender), lastName(gender), suffix(gender))
100}
101
102// MaleFullNameWithSuffix generates suffixed male full name
103// if suffixes for the given language are available
104func MaleFullNameWithSuffix() string {
105	return fullNameWithPrefix("male")
106}
107
108// FemaleFullNameWithSuffix generates suffixed female full name
109// if suffixes for the given language are available
110func FemaleFullNameWithSuffix() string {
111	return fullNameWithPrefix("female")
112}
113
114// FullNameWithSuffix generates suffixed full name
115// if suffixes for the given language are available
116func FullNameWithSuffix() string {
117	return fullNameWithPrefix(randGender())
118}
119
120func fullName(gender string) string {
121	switch r.Intn(10) {
122	case 0:
123		return fullNameWithPrefix(gender)
124	case 1:
125		return fullNameWithSuffix(gender)
126	default:
127		return join(firstName(gender), lastName(gender))
128	}
129}
130
131// MaleFullName generates male full name
132// it can occasionally include prefix or suffix
133func MaleFullName() string {
134	return fullName("male")
135}
136
137// FemaleFullName generates female full name
138// it can occasionally include prefix or suffix
139func FemaleFullName() string {
140	return fullName("female")
141}
142
143// FullName generates full name
144// it can occasionally include prefix or suffix
145func FullName() string {
146	return fullName(randGender())
147}