forked from brianvoe/gofakeit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
company.go
144 lines (127 loc) · 3.78 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
package gofakeit
// Company will generate a random company name string
func Company() (company string) {
return getRandValue([]string{"company", "name"})
}
// CompanySuffix will generate a random company suffix string
func CompanySuffix() string {
return getRandValue([]string{"company", "suffix"})
}
// BuzzWord will generate a random company buzz word string
func BuzzWord() string {
return getRandValue([]string{"company", "buzzwords"})
}
// BS will generate a random company bs string
func BS() string {
return getRandValue([]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 &JobInfo{
Company: Company(),
Title: JobTitle(),
Descriptor: JobDescriptor(),
Level: JobLevel(),
}
}
// JobTitle will generate a random job title string
func JobTitle() string {
return getRandValue([]string{"job", "title"})
}
// JobDescriptor will generate a random job descriptor string
func JobDescriptor() string {
return getRandValue([]string{"job", "descriptor"})
}
// JobLevel will generate a random job level string
func JobLevel() string {
return getRandValue([]string{"job", "level"})
}
func addCompanyLookup() {
AddFuncLookup("company", Info{
Display: "Company",
Category: "company",
Description: "Random company name",
Example: "Moen, Pagac and Wuckert",
Output: "string",
Call: func(m *map[string][]string, info *Info) (interface{}, error) {
return Company(), nil
},
})
AddFuncLookup("companysuffix", Info{
Display: "Company Suffix",
Category: "company",
Description: "Random company name suffix",
Example: "Inc",
Output: "string",
Call: func(m *map[string][]string, info *Info) (interface{}, error) {
return CompanySuffix(), nil
},
})
AddFuncLookup("bs", Info{
Display: "BS",
Category: "company",
Description: "Random bs company word",
Example: "front-end",
Output: "string",
Call: func(m *map[string][]string, info *Info) (interface{}, error) {
return BS(), nil
},
})
AddFuncLookup("buzzword", Info{
Display: "Buzzword",
Category: "company",
Description: "Random company buzzwords",
Example: "disintermediate",
Output: "string",
Call: func(m *map[string][]string, info *Info) (interface{}, error) {
return BuzzWord(), 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",
Call: func(m *map[string][]string, info *Info) (interface{}, error) {
return Job(), nil
},
})
AddFuncLookup("jobtitle", Info{
Display: "Job Title",
Category: "company",
Description: "Random job title",
Example: "Director",
Output: "string",
Call: func(m *map[string][]string, info *Info) (interface{}, error) {
return JobTitle(), nil
},
})
AddFuncLookup("jobdescriptor", Info{
Display: "Job Descriptor",
Category: "company",
Description: "Random job descriptor",
Example: "Central",
Output: "string",
Call: func(m *map[string][]string, info *Info) (interface{}, error) {
return JobDescriptor(), nil
},
})
AddFuncLookup("joblevel", Info{
Display: "Job Level",
Category: "company",
Description: "Random job level",
Example: "Assurance",
Output: "string",
Call: func(m *map[string][]string, info *Info) (interface{}, error) {
return JobLevel(), nil
},
})
}