-
-
Notifications
You must be signed in to change notification settings - Fork 266
/
app.go
96 lines (81 loc) · 2.1 KB
/
app.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
package gofakeit
import (
"fmt"
)
// AppName will generate a random app name
func AppName() string {
return appName(GlobalFaker)
}
// AppName will generate a random app name
func (f *Faker) AppName() string {
return appName(f)
}
func appName(f *Faker) string {
name := ""
switch number(f, 1, 3) {
case 1:
name = noun(f) + verb(f)
case 2:
name = color(f) + noun(f)
case 3:
name = animal(f) + verb(f)
}
return title(name)
}
// AppVersion will generate a random app version
func AppVersion() string {
return appVersion(GlobalFaker)
}
// AppVersion will generate a random app version
func (f *Faker) AppVersion() string {
return appVersion(f)
}
func appVersion(f *Faker) string {
return fmt.Sprintf("%d.%d.%d", number(f, 1, 5), number(f, 1, 20), number(f, 1, 20))
}
// AppAuthor will generate a random company or person name
func AppAuthor() string {
return appAuthor(GlobalFaker)
}
// AppAuthor will generate a random company or person name
func (f *Faker) AppAuthor() string {
return appAuthor(f)
}
func appAuthor(f *Faker) string {
if boolFunc(f) {
return name(f)
}
return company(f)
}
func addAppLookup() {
AddFuncLookup("appname", Info{
Display: "App Name",
Category: "app",
Description: "Software program designed for a specific purpose or task on a computer or mobile device",
Example: "Parkrespond",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return appName(f), nil
},
})
AddFuncLookup("appversion", Info{
Display: "App Version",
Category: "app",
Description: "Particular release of an application in Semantic Versioning format",
Example: "1.12.14",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return appVersion(f), nil
},
})
AddFuncLookup("appauthor", Info{
Display: "App Author",
Category: "app",
Description: "Person or group creating and developing an application",
Example: "Qado Energy, Inc.",
Output: "string",
Generate: func(f *Faker, m *MapParams, info *Info) (any, error) {
return appAuthor(f), nil
},
})
}