forked from brianvoe/gofakeit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
company.go
172 lines (138 loc) · 5.38 KB
/
company.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
package gofakeit
import "math/rand"
// Company will generate a random company name string
func Company() string { return company(globalFaker.Rand) }
// Company will generate a random company name string
func (f *Faker) Company() string { return company(f.Rand) }
func company(r *rand.Rand) string { return getRandValue(r, []string{"company", "name"}) }
// CompanySuffix will generate a random company suffix string
func CompanySuffix() string { return companySuffix(globalFaker.Rand) }
// CompanySuffix will generate a random company suffix string
func (f *Faker) CompanySuffix() string { return companySuffix(f.Rand) }
func companySuffix(r *rand.Rand) string { return getRandValue(r, []string{"company", "suffix"}) }
// BuzzWord will generate a random company buzz word string
func BuzzWord() string { return buzzWord(globalFaker.Rand) }
// BuzzWord will generate a random company buzz word string
func (f *Faker) BuzzWord() string { return buzzWord(f.Rand) }
func buzzWord(r *rand.Rand) string { return getRandValue(r, []string{"company", "buzzwords"}) }
// BS will generate a random company bs string
func BS() string { return bs(globalFaker.Rand) }
// BS will generate a random company bs string
func (f *Faker) BS() string { return bs(f.Rand) }
func bs(r *rand.Rand) string { return getRandValue(r, []string{"company", "bs"}) }
// JobInfo is a struct of job information
type JobInfo struct {
Company string `json:"company" xml:"company"`
Title string `json:"title" xml:"title"`
Descriptor string `json:"descriptor" xml:"descriptor"`
Level string `json:"level" xml:"level"`
}
// Job will generate a struct with random job information
func Job() *JobInfo { return job(globalFaker.Rand) }
// Job will generate a struct with random job information
func (f *Faker) Job() *JobInfo { return job(f.Rand) }
func job(r *rand.Rand) *JobInfo {
return &JobInfo{
Company: company(r),
Title: jobTitle(r),
Descriptor: jobDescriptor(r),
Level: jobLevel(r),
}
}
// JobTitle will generate a random job title string
func JobTitle() string { return jobTitle(globalFaker.Rand) }
// JobTitle will generate a random job title string
func (f *Faker) JobTitle() string { return jobTitle(f.Rand) }
func jobTitle(r *rand.Rand) string { return getRandValue(r, []string{"job", "title"}) }
// JobDescriptor will generate a random job descriptor string
func JobDescriptor() string { return jobDescriptor(globalFaker.Rand) }
// JobDescriptor will generate a random job descriptor string
func (f *Faker) JobDescriptor() string { return jobDescriptor(f.Rand) }
func jobDescriptor(r *rand.Rand) string { return getRandValue(r, []string{"job", "descriptor"}) }
// JobLevel will generate a random job level string
func JobLevel() string { return jobLevel(globalFaker.Rand) }
// JobLevel will generate a random job level string
func (f *Faker) JobLevel() string { return jobLevel(f.Rand) }
func jobLevel(r *rand.Rand) string { return getRandValue(r, []string{"job", "level"}) }
func addCompanyLookup() {
AddFuncLookup("company", Info{
Display: "Company",
Category: "company",
Description: "Random company name",
Example: "Moen, Pagac and Wuckert",
Output: "string",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) {
return company(r), nil
},
})
AddFuncLookup("companysuffix", Info{
Display: "Company Suffix",
Category: "company",
Description: "Random company name suffix",
Example: "Inc",
Output: "string",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) {
return companySuffix(r), nil
},
})
AddFuncLookup("bs", Info{
Display: "BS",
Category: "company",
Description: "Random bs company word",
Example: "front-end",
Output: "string",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) {
return bs(r), nil
},
})
AddFuncLookup("buzzword", Info{
Display: "Buzzword",
Category: "company",
Description: "Random company buzzwords",
Example: "disintermediate",
Output: "string",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) {
return buzzWord(r), nil
},
})
AddFuncLookup("job", Info{
Display: "Job",
Category: "company",
Description: "Random job data set",
Example: `{company: "Moen, Pagac and Wuckert", title: "Director", descriptor: "Central", level: "Assurance"}`,
Output: "map[string]string",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) {
return job(r), nil
},
})
AddFuncLookup("jobtitle", Info{
Display: "Job Title",
Category: "company",
Description: "Random job title",
Example: "Director",
Output: "string",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) {
return jobTitle(r), nil
},
})
AddFuncLookup("jobdescriptor", Info{
Display: "Job Descriptor",
Category: "company",
Description: "Random job descriptor",
Example: "Central",
Output: "string",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) {
return jobDescriptor(r), nil
},
})
AddFuncLookup("joblevel", Info{
Display: "Job Level",
Category: "company",
Description: "Random job level",
Example: "Assurance",
Output: "string",
Generate: func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) {
return jobLevel(r), nil
},
})
}