aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/icrowley/fake/names.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/icrowley/fake/names.go')
-rw-r--r--vendor/github.com/icrowley/fake/names.go147
1 files changed, 147 insertions, 0 deletions
diff --git a/vendor/github.com/icrowley/fake/names.go b/vendor/github.com/icrowley/fake/names.go
new file mode 100644
index 00000000..fde3eaf2
--- /dev/null
+++ b/vendor/github.com/icrowley/fake/names.go
@@ -0,0 +1,147 @@
+package fake
+
+func randGender() string {
+ g := "male"
+ if r.Intn(2) == 0 {
+ g = "female"
+ }
+ return g
+}
+
+func firstName(gender string) string {
+ return lookup(lang, gender+"_first_names", true)
+}
+
+// MaleFirstName generates male first name
+func MaleFirstName() string {
+ return firstName("male")
+}
+
+// FemaleFirstName generates female first name
+func FemaleFirstName() string {
+ return firstName("female")
+}
+
+// FirstName generates first name
+func FirstName() string {
+ return firstName(randGender())
+}
+
+func lastName(gender string) string {
+ return lookup(lang, gender+"_last_names", true)
+}
+
+// MaleLastName generates male last name
+func MaleLastName() string {
+ return lastName("male")
+}
+
+// FemaleLastName generates female last name
+func FemaleLastName() string {
+ return lastName("female")
+}
+
+// LastName generates last name
+func LastName() string {
+ return lastName(randGender())
+}
+
+func patronymic(gender string) string {
+ return lookup(lang, gender+"_patronymics", false)
+}
+
+// MalePatronymic generates male patronymic
+func MalePatronymic() string {
+ return patronymic("male")
+}
+
+// FemalePatronymic generates female patronymic
+func FemalePatronymic() string {
+ return patronymic("female")
+}
+
+// Patronymic generates patronymic
+func Patronymic() string {
+ return patronymic(randGender())
+}
+
+func prefix(gender string) string {
+ return lookup(lang, gender+"_name_prefixes", false)
+}
+
+func suffix(gender string) string {
+ return lookup(lang, gender+"_name_suffixes", false)
+}
+
+func fullNameWithPrefix(gender string) string {
+ return join(prefix(gender), firstName(gender), lastName(gender))
+}
+
+// MaleFullNameWithPrefix generates prefixed male full name
+// if prefixes for the given language are available
+func MaleFullNameWithPrefix() string {
+ return fullNameWithPrefix("male")
+}
+
+// FemaleFullNameWithPrefix generates prefixed female full name
+// if prefixes for the given language are available
+func FemaleFullNameWithPrefix() string {
+ return fullNameWithPrefix("female")
+}
+
+// FullNameWithPrefix generates prefixed full name
+// if prefixes for the given language are available
+func FullNameWithPrefix() string {
+ return fullNameWithPrefix(randGender())
+}
+
+func fullNameWithSuffix(gender string) string {
+ return join(firstName(gender), lastName(gender), suffix(gender))
+}
+
+// MaleFullNameWithSuffix generates suffixed male full name
+// if suffixes for the given language are available
+func MaleFullNameWithSuffix() string {
+ return fullNameWithPrefix("male")
+}
+
+// FemaleFullNameWithSuffix generates suffixed female full name
+// if suffixes for the given language are available
+func FemaleFullNameWithSuffix() string {
+ return fullNameWithPrefix("female")
+}
+
+// FullNameWithSuffix generates suffixed full name
+// if suffixes for the given language are available
+func FullNameWithSuffix() string {
+ return fullNameWithPrefix(randGender())
+}
+
+func fullName(gender string) string {
+ switch r.Intn(10) {
+ case 0:
+ return fullNameWithPrefix(gender)
+ case 1:
+ return fullNameWithSuffix(gender)
+ default:
+ return join(firstName(gender), lastName(gender))
+ }
+}
+
+// MaleFullName generates male full name
+// it can occasionally include prefix or suffix
+func MaleFullName() string {
+ return fullName("male")
+}
+
+// FemaleFullName generates female full name
+// it can occasionally include prefix or suffix
+func FemaleFullName() string {
+ return fullName("female")
+}
+
+// FullName generates full name
+// it can occasionally include prefix or suffix
+func FullName() string {
+ return fullName(randGender())
+}