@@ -41,17 +41,17 @@ go get github.com/brianvoe/gofakeit/v7
4141``` go
4242import " github.com/brianvoe/gofakeit/v7"
4343
44- gofakeit.Name () // Markus Moen
45- gofakeit.Email () // alaynawuckert@kozey.biz
46- gofakeit.Phone () // (570)245-7485
47- gofakeit.BS () // front-end
48- gofakeit.BeerName () // Duvel
49- gofakeit.Color () // MediumOrchid
50- gofakeit.Company () // Moen, Pagac and Wuckert
51- gofakeit.CreditCardNumber () // 4287271570245748
52- gofakeit.HackerPhrase () // Connecting the array won't do anything, we need to generate the haptic COM driver!
53- gofakeit.JobTitle () // Director
54- gofakeit.CurrencyShort () // USD
44+ gofakeit.Name () // Markus Moen
45+ gofakeit.Email () // alaynawuckert@kozey.biz
46+ gofakeit.Phone () // (570)245-7485
47+ gofakeit.BS () // front-end
48+ gofakeit.BeerName () // Duvel
49+ gofakeit.Color () // MediumOrchid
50+ gofakeit.Company () // Moen, Pagac and Wuckert
51+ gofakeit.CreditCardNumber (nil ) // 4287271570245748
52+ gofakeit.HackerPhrase () // Connecting the array won't do anything, we need to generate the haptic COM driver!
53+ gofakeit.JobTitle () // Director
54+ gofakeit.CurrencyShort () // USD
5555```
5656
5757[ See full list of functions] ( #functions )
@@ -91,7 +91,7 @@ import (
9191faker := gofakeit.New (0 )
9292
9393// NewFaker takes in a source and whether or not it should be thread safe
94- faker := gofakeit.NewFaker (source rand.Source , threadSafe bool )
94+ faker := gofakeit.NewFaker (src rand.Source , lock bool )
9595
9696// PCG Pseudo
9797faker := gofakeit.NewFaker (rand.NewPCG (11 , 11 ), true )
@@ -171,7 +171,7 @@ fmt.Println(f.Int) // -7825289004089916589
171171fmt.Println (*f.Pointer ) // -343806609094473732
172172fmt.Println (f.Name ) // fred
173173fmt.Println (f.Sentence ) // Record river mind.
174- fmt.Println (fStr ) // world
174+ fmt.Println (f. RandStr ) // world
175175fmt.Println (f.Number ) // 4
176176fmt.Println (f.Regex ) // cbdfc
177177fmt.Println (f.Map ) // map[PxLIo:52 lxwnqhqc:846]
@@ -210,7 +210,7 @@ func (c *Friend) Fake(f *gofakeit.Faker) (any, error) {
210210type Age time.Time
211211
212212func (c *Age ) Fake (f *gofakeit .Faker ) (any , error ) {
213- return f.DateRange (time.Now ().AddDate (-100 , 0 , 0 ), time.Now ().AddDate (-18 , 0 , 0 )), nil
213+ return Age ( f.DateRange (time.Now ().AddDate (-100 , 0 , 0 ), time.Now ().AddDate (-18 , 0 , 0 ) )), nil
214214}
215215
216216// This is the struct that we cannot modify to add struct tags
@@ -221,8 +221,8 @@ type User struct {
221221
222222var u User
223223gofakeit.Struct (&u)
224- fmt.Printf ( " %s " , f .Name ) // billy
225- fmt.Printf ( " %s " , f. Age ) // 1990-12-07 04:14:25.685339029 +0000 UTC
224+ fmt.Println (u .Name ) // billy
225+ fmt.Println (time. Time (*u. Age ) ) // 1990-12-07 04:14:25.685339029 +0000 UTC
226226```
227227
228228## Custom Functions
@@ -240,7 +240,7 @@ gofakeit.AddFuncLookup("friendname", gofakeit.Info{
240240 Description : " Random friend name" ,
241241 Example : " bill" ,
242242 Output : " string" ,
243- Generate : func (f *Faker, m *gofakeit.MapParams , info *gofakeit.Info ) (any, error ) {
243+ Generate : func (f *gofakeit. Faker , m *gofakeit.MapParams , info *gofakeit.Info ) (any, error ) {
244244 return f.RandomString ([]string {" bill" , " bob" , " sally" }), nil
245245 },
246246})
@@ -254,7 +254,7 @@ gofakeit.AddFuncLookup("jumbleword", gofakeit.Info{
254254 Params : []gofakeit.Param {
255255 {Field: " word" , Type: " string" , Description: " Word you want to jumble" },
256256 },
257- Generate : func (f *Faker, m *gofakeit.MapParams , info *gofakeit.Info ) (any, error ) {
257+ Generate : func (f *gofakeit. Faker , m *gofakeit.MapParams , info *gofakeit.Info ) (any, error ) {
258258 word , err := info.GetString (m, " word" )
259259 if err != nil {
260260 return nil , err
@@ -273,8 +273,8 @@ type Foo struct {
273273
274274var f Foo
275275gofakeit.Struct (&f)
276- fmt.Printf ( " %s " , f.FriendName ) // bill
277- fmt.Printf ( " %s " , f.JumbleWord ) // loredlowlh
276+ fmt.Println ( f.FriendName ) // bill
277+ fmt.Println ( f.JumbleWord ) // loredlowlh
278278```
279279
280280## Templates
@@ -328,17 +328,17 @@ func main() {
328328 {{RandomString (SliceString "Warm regards" "Best wishes" "Sincerely")}}
329329 {{$person:=Person}}
330330 {{$person.FirstName}} {{$person.LastName}}
331- {{$person.Email}}
332- {{$person.Phone}}
331+ {{$person.Contact. Email}}
332+ {{$person.Contact. Phone}}
333333 `
334334
335- value , err := gofakeit.Template (template, &TemplateOptions{Data: 5 })
335+ value , err := gofakeit.Template (template, &gofakeit. TemplateOptions {Data: 5 })
336336
337337 if err != nil {
338338 fmt.Println (err)
339339 }
340340
341- fmt.Println (string ( value) )
341+ fmt.Println (value)
342342}
343343```
344344
@@ -353,6 +353,7 @@ Greetings!
353353Quia voluptatem voluptatem voluptatem. Quia voluptatem voluptatem voluptatem. Quia voluptatem voluptatem voluptatem.
354354
355355Warm regards
356+
356357Kaitlyn Krajcik
357358kaitlynkrajcik@krajcik
358359570-245-7485
0 commit comments