forked from bxcodec/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_single_fake_data_test.go
71 lines (59 loc) · 2.47 KB
/
example_single_fake_data_test.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
package faker_test
import "github.com/bxcodec/faker/v3"
// Single fake function can be used for retrieving particular values.
func Example_singleFakeData() {
// Address
faker.Latitude() // => 81.12195
faker.Longitude() // => -84.38158
// Datetime
faker.UnixTime() // => 1197930901
faker.Date() // => 1982-02-27
faker.TimeString() // => 03:10:25
faker.MonthName() // => February
faker.YearString() // => 1994
faker.DayOfWeek() // => Sunday
faker.DayOfMonth() // => 20
faker.Timestamp() // => 1973-06-21 14:50:46
faker.Century() // => IV
faker.Timezone() // => Asia/Jakarta
faker.Timeperiod() // => PM
// Internet
faker.Email() // => [email protected]
faker.MacAddress() // => cd:65:e1:d4:76:c6
faker.DomainName() // => FWZcaRE.org
faker.URL() // => https://www.oEuqqAY.org/QgqfOhd
faker.Username() // => lVxELHS
faker.IPv4() // => 99.23.42.63
faker.IPv6() // => 975c:fb2c:2133:fbdd:beda:282e:1e0a:ec7d
faker.Password() // => dfJdyHGuVkHBgnHLQQgpINApynzexnRpgIKBpiIjpTP
// Words and Sentences
faker.Word() // => nesciunt
faker.Sentence() // => Consequatur perferendis voluptatem accusantium.
faker.Paragraph() // => Aut consequatur sit perferendis accusantium voluptatem. Accusantium perferendis consequatur voluptatem sit aut. Aut sit accusantium consequatur voluptatem perferendis. Perferendis voluptatem aut accusantium consequatur sit.
// Payment
faker.CCType() // => American Express
faker.CCNumber() // => 373641309057568
faker.Currency() // => USD
faker.AmountWithCurrency() // => USD 49257.100
// Person
faker.TitleMale() // => Mr.
faker.TitleFemale() // => Mrs.
faker.FirstName() // => Whitney
faker.FirstNameMale() // => Kenny
faker.FirstNameFemale() // => Jana
faker.LastName() // => Rohan
faker.Name() // => Mrs. Casandra Kiehn
// Phone
faker.Phonenumber() // -> 201-886-0269
faker.TollFreePhoneNumber() // => (777) 831-964572
faker.E164PhoneNumber() // => +724891571063
// UUID
faker.UUIDHyphenated() // => 8f8e4463-9560-4a38-9b0c-ef24481e4e27
faker.UUIDDigit() // => 90ea6479fd0e4940af741f0a87596b73
// Unique values
faker.SetGenerateUniqueValues(true) // Enable unique data generation on single fake data functions
faker.Word()
// ...
faker.SetGenerateUniqueValues(false) // Disable unique data generation on single fake data functions
faker.ResetUnique() // Forget all generated unique values
}