import "github.com/brianvoe/gofakeit"
Package gofakeit provides a set of functions that generate random data
Code:
Seed(11) fmt.Println("Name:", Name()) fmt.Println("Email:", Email()) fmt.Println("Phone:", Phone()) fmt.Println("Address:", Address().Address) fmt.Println("BS:", BS()) fmt.Println("Beer Name:", BeerName()) fmt.Println("Color:", Color()) fmt.Println("Company:", Company()) fmt.Println("Credit Card:", CreditCardNumber(nil)) fmt.Println("Hacker Phrase:", HackerPhrase()) fmt.Println("Job Title:", JobTitle()) fmt.Println("Password:", Password(true, true, true, true, false, 32))
Output:
Name: Markus Moen Email: alaynawuckert@kozey.biz Phone: 9948995369 Address: 35300 South Roads haven, Hilllville, Montana 30232 BS: e-enable Beer Name: Weihenstephaner Hefeweissbier Color: MidnightBlue Company: Epsilon Credit Card: 6375991714800889 Hacker Phrase: You can't quantify the application without navigating the bluetooth SMS microchip! Job Title: Architect Password: SHylpDU2nf9(,U*RaJKM1cOL47VY.BQw
Code:
Seed(11) type Foo struct { Bar string Int int Name string `fake:"{firstname}"` Number string `fake:"{number:1,10}"` Skip *string `fake:"skip"` } type FooMany struct { Foos []Foo `fakesize:"1"` Names []string `fake:"{firstname}" fakesize:"3"` } var fm FooMany Struct(&fm) fmt.Printf("%v\n", fm.Foos) fmt.Printf("%v\n", fm.Names)
Output:
[{bRMaRxHki -8576773003117070818 Carole 6 <nil>}] [Dawn Zachery Amie]
Code:
Seed(11) AddFuncLookup("friendname", Info{ Category: "custom", Description: "Random friend name", Example: "bill", Output: "string", Generate: func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) { return RandomString([]string{"bill", "bob", "sally"}), nil }, }) type Foo struct { FriendName string `fake:"{friendname}"` } var f Foo Struct(&f) fmt.Printf("%s", f.FriendName)
Output:
bill
Code:
Seed(11) type Foo struct { Bar string Int int Pointer *int Name string `fake:"{firstname}"` Number string `fake:"{number:1,10}"` Skip *string `fake:"skip"` } var f Foo Struct(&f) fmt.Printf("%s\n", f.Bar) fmt.Printf("%d\n", f.Int) fmt.Printf("%d\n", *f.Pointer) fmt.Printf("%v\n", f.Name) fmt.Printf("%v\n", f.Number) fmt.Printf("%v\n", f.Skip)
Output:
bRMaRxHki -8576773003117070818 -7054675846543980602 Enrique 4 <nil>
address.go animal.go app.go auth.go beer.go car.go color.go company.go csv.go doc.go emoji.go faker.go file.go food.go game.go generate.go hacker.go helpers.go hipster.go image.go internet.go json.go languages.go lookup.go lorem.go misc.go number.go payment.go person.go string.go struct.go time.go words.go xml.go
FuncLookups is the primary map array with mapping to all available data
AchAccount will generate a 12 digit account number
Code:
Seed(11) fmt.Println(AchAccount())
Output:
413645994899
AchRouting will generate a 9 digit routing number
Code:
Seed(11) fmt.Println(AchRouting())
Output:
713645994
AddFuncLookup takes a field and adds it to map
Adjective will generate a random adjective
Code:
Seed(11) fmt.Println(Adjective())
Output:
genuine
Adverb will generate a random adverb
Code:
Seed(11) fmt.Println(Adverb())
Output:
smoothly
Animal will return a random animal
Code:
Seed(11) fmt.Println(Animal())
Output:
elk
AnimalType will return a random animal type
Code:
Seed(11) fmt.Println(AnimalType())
Output:
amphibians
AppAuthor will generate a random company or person name
Code:
Seed(11) fmt.Println(AppAuthor())
Output:
Qado Energy, Inc.
AppName will generate a random app name
Code:
Seed(11) fmt.Println(AppName())
Output:
Parkrespond
AppVersion will generate a random app version
Code:
Seed(11) fmt.Println(AppVersion())
Output:
1.12.14
BS will generate a random company bs string
Code:
Seed(11) fmt.Println(BS())
Output:
front-end
BeerAlcohol will return a random beer alcohol level between 2.0 and 10.0
Code:
Seed(11) fmt.Println(BeerAlcohol())
Output:
2.7%
BeerBlg will return a random beer blg between 5.0 and 20.0
Code:
Seed(11) fmt.Println(BeerBlg())
Output:
6.4°Blg
BeerHop will return a random beer hop
Code:
Seed(11) fmt.Println(BeerHop())
Output:
Glacier
BeerIbu will return a random beer ibu value between 10 and 100
Code:
Seed(11) fmt.Println(BeerIbu())
Output:
29 IBU
BeerMalt will return a random beer malt
Code:
Seed(11) fmt.Println(BeerMalt())
Output:
Munich
BeerName will return a random beer name
Code:
Seed(11) fmt.Println(BeerName())
Output:
Duvel
BeerStyle will return a random beer style
Code:
Seed(11) fmt.Println(BeerStyle())
Output:
European Amber Lager
BeerYeast will return a random beer yeast
Code:
Seed(11) fmt.Println(BeerYeast())
Output:
1388 - Belgian Strong Ale
BitcoinAddress will generate a random bitcoin address consisting of numbers, upper and lower characters
Code:
Seed(11) fmt.Println(BitcoinAddress())
Output:
1lWLbxojXq6BqWX7X60VkcDIvYA
BitcoinPrivateKey will generate a random bitcoin private key base58 consisting of numbers, upper and lower characters
Code:
Seed(11) fmt.Println(BitcoinPrivateKey())
Output:
5KWjEJ7SnBNJyDjdPUjLuYByYzM9rG1trax8c2NTSBtv7YtR57v
Bool will generate a random boolean value
Code:
Seed(11) fmt.Println(Bool())
Output:
false
Breakfast will return a random breakfast name
Code:
Seed(11) fmt.Println(Breakfast())
Output:
Blueberry banana happy face pancakes
BuzzWord will generate a random company buzz word string
Code:
Seed(11) fmt.Println(BuzzWord())
Output:
disintermediate
func CSV(co *CSVOptions) ([]byte, error)
CSV generates an object or an array of objects in json format
Code:
Seed(11) value, err := CSV(&CSVOptions{ RowCount: 3, Fields: []Field{ {Name: "id", Function: "autoincrement"}, {Name: "first_name", Function: "firstname"}, {Name: "last_name", Function: "lastname"}, {Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}}, }, }) if err != nil { fmt.Println(err) } fmt.Println(string(value))
Output:
id,first_name,last_name,password 1,Markus,Moen,Dc0VYXjkWABx 2,Osborne,Hilll,XPJ9OVNbs5lm
CarFuelType will return a random fuel type
Code:
Seed(11) fmt.Println(CarFuelType())
Output:
CNG
CarMaker will return a random car maker
Code:
Seed(11) fmt.Println(CarMaker())
Output:
Nissan
CarModel will return a random car model
Code:
Seed(11) fmt.Println(CarModel())
Output:
Aveo
CarTransmissionType will return a random transmission type
Code:
Seed(11) fmt.Println(CarTransmissionType())
Output:
Manual
CarType will generate a random car type string
Code:
Seed(11) fmt.Println(CarType())
Output:
Passenger car mini
Cat will return a random cat breed
Code:
Seed(11) fmt.Println(Cat())
Output:
Sokoke
Categories will return a map string array of available data categories and sub categories
ChromeUserAgent will generate a random chrome browser user agent string
Code:
Seed(11) fmt.Println(ChromeUserAgent())
Output:
Mozilla/5.0 (X11; Linux i686) AppleWebKit/5312 (KHTML, like Gecko) Chrome/39.0.836.0 Mobile Safari/5312
City will generate a random city string
Code:
Seed(11) fmt.Println(City())
Output:
Marcelside
Color will generate a random color string
Code:
Seed(11) fmt.Println(Color())
Output:
MediumOrchid
Company will generate a random company name string
Code:
Seed(11) fmt.Println(Company())
Output:
ClearHealthCosts
CompanySuffix will generate a random company suffix string
Code:
Seed(11) fmt.Println(CompanySuffix())
Output:
Inc
Country will generate a random country string
Code:
Seed(11) fmt.Println(Country())
Output:
Tajikistan
CountryAbr will generate a random abbreviated country string
Code:
Seed(11) fmt.Println(CountryAbr())
Output:
FI
CreditCardCvv will generate a random CVV number Its a string because you could have 017 as an exp date
Code:
Seed(11) fmt.Println(CreditCardCvv())
Output:
513
CreditCardExp will generate a random credit card expiration date string Exp date will always be a future date
Code:
Seed(11) fmt.Println(CreditCardExp())
Output:
01/23
func CreditCardNumber(cco *CreditCardOptions) string
CreditCardNumber will generate a random luhn credit card number
Code:
Seed(11) fmt.Println(CreditCardNumber(nil)) fmt.Println(CreditCardNumber(&CreditCardOptions{Types: []string{"visa", "discover"}})) fmt.Println(CreditCardNumber(&CreditCardOptions{Bins: []string{"4111"}})) fmt.Println(CreditCardNumber(&CreditCardOptions{Gaps: true}))
Output:
4364599489953690649 6011425914583029 4111020276132178 2131 0889 9822 7212
CreditCardType will generate a random credit card type string
Code:
Seed(11) fmt.Println(CreditCardType())
Output:
Visa
CurrencyLong will generate a random long currency name
Code:
Seed(11) fmt.Println(CurrencyLong())
Output:
Iraq Dinar
CurrencyShort will generate a random short currency value
Code:
Seed(11) fmt.Println(CurrencyShort())
Output:
IQD
Date will generate a random time.Time struct
Code:
Seed(11) fmt.Println(Date())
Output:
1908-12-07 04:14:25.685339029 +0000 UTC
DateRange will generate a random time.Time struct between a start and end date
Code:
Seed(11)
fmt.Println(DateRange(time.Unix(0, 484633944473634951), time.Unix(0, 1431318744473668209))) // May 10, 1985 years to May 10, 2015
Output:
2012-02-04 14:10:37.166933216 +0000 UTC
Day will generate a random day between 1 - 31
Code:
Seed(11) fmt.Println(Day())
Output:
12
Dessert will return a random dessert name
Code:
Seed(11) fmt.Println(Dessert())
Output:
French napoleons
Digit will generate a single ASCII digit
Code:
Seed(11) fmt.Println(Digit())
Output:
0
DigitN will generate a random string of length N consists of ASCII digits (note it can start with 0).
Code:
Seed(11) fmt.Println(DigitN(10))
Output:
0136459948
Dinner will return a random dinner name
Code:
Seed(11) fmt.Println(Dinner())
Output:
Wild addicting dip
Dog will return a random dog breed
Code:
Seed(11) fmt.Println(Dog())
Output:
Norwich Terrier
DomainName will generate a random url domain name
Code:
Seed(11) fmt.Println(DomainName())
Output:
centraltarget.biz
DomainSuffix will generate a random domain suffix
Code:
Seed(11) fmt.Println(DomainSuffix())
Output:
org
Email will generate a random email string
Code:
Seed(11) fmt.Println(Email())
Output:
markusmoen@pagac.net
Emoji will return a random fun emoji
Code:
Seed(11) fmt.Println(Emoji())
Output:
🧛
EmojiAlias will return a random fun emoji alias
Code:
Seed(11) fmt.Println(EmojiAlias())
Output:
deaf_person
EmojiCategory will return a random fun emoji category
Code:
Seed(11) fmt.Println(EmojiCategory())
Output:
Food & Drink
EmojiDescription will return a random fun emoji description
Code:
Seed(11) fmt.Println(EmojiDescription())
Output:
confetti ball
EmojiTag will return a random fun emoji tag
Code:
Seed(11) fmt.Println(EmojiTag())
Output:
strong
FarmAnimal will return a random animal that usually lives on a farm
Code:
Seed(11) fmt.Println(FarmAnimal())
Output:
Chicken
FileExtension will generate a random file extension
Code:
Seed(11) fmt.Println(FileExtension())
Output:
nes
FileMimeType will generate a random mime file type
Code:
Seed(11) fmt.Println(FileMimeType())
Output:
application/dsptype
FirefoxUserAgent will generate a random firefox broswer user agent string
Code:
Seed(11) fmt.Println(FirefoxUserAgent())
Output:
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_8_3 rv:7.0) Gecko/1908-07-12 Firefox/37.0
FirstName will generate a random first name
Code:
Seed(11) fmt.Println(FirstName())
Output:
Markus
FlipACoin will return a random value of Heads or Tails
Code:
Seed(11) fmt.Println(FlipACoin())
Output:
Tails
Float32 will generate a random float32 value
Code:
Seed(11) fmt.Println(Float32())
Output:
3.1128167e+37
Float32Range will generate a random float32 value between min and max
Code:
Seed(11) fmt.Println(Float32Range(0, 9999999))
Output:
914774.6
Float64 will generate a random float64 value
Code:
Seed(11) fmt.Println(Float64())
Output:
1.644484108270445e+307
Float64Range will generate a random float64 value between min and max
Code:
Seed(11) fmt.Println(Float64Range(0, 9999999))
Output:
914774.5585333086
Fruit will return a random fruit name
Code:
Seed(11) fmt.Println(Fruit())
Output:
Date
Gamertag will generate a random video game username
Code:
Seed(11) fmt.Println(Gamertag())
Output:
footinterpret63
Gender will generate a random gender string
Code:
Seed(11) fmt.Println(Gender())
Output:
female
Generate fake information from given string. Replaceable values should be within {}
Functions Ex: {firstname} - billy Ex: {sentence:3} - Record river mind. Ex: {number:1,10} - 4 Ex: {uuid} - 590c1440-9888-45b0-bd51-a817ee07c3f2
Letters/Numbers Ex: ### - 481 - random numbers Ex: ??? - fda - random letters
For a complete list of runnable functions use FuncsLookup
Code:
Seed(11) fmt.Println(Generate("{firstname} {lastname} ssn is {ssn} and lives at {street}")) fmt.Println(Generate("{sentence:3}")) fmt.Println(Generate("{shuffleints:[1,2,3]}")) fmt.Println(Generate("{number:1,50}")) fmt.Println(Generate("{shufflestrings:[key:value,int:string,1:2,a:b]}"))
Output:
Markus Moen ssn is 952284213 and lives at 599 New Cliffs stad Arrival tour security. [1 3 2] 34 [a:b key:value int:string 1:2]
HTTPMethod will generate a random http method
Code:
Seed(11) fmt.Println(HTTPMethod())
Output:
HEAD
HTTPStatusCode will generate a random status code
Code:
Seed(11) fmt.Println(HTTPStatusCode())
Output:
404
HTTPStatusCodeSimple will generate a random simple status code
Code:
Seed(11) fmt.Println(HTTPStatusCodeSimple())
Output:
200
HackerAbbreviation will return a random hacker abbreviation
Code:
Seed(11) fmt.Println(HackerAbbreviation())
Output:
ADP
HackerAdjective will return a random hacker adjective
Code:
Seed(11) fmt.Println(HackerAdjective())
Output:
wireless
HackerNoun will return a random hacker noun
Code:
Seed(11) fmt.Println(HackerNoun())
Output:
driver
HackerPhrase will return a random hacker sentence
Code:
Seed(11) fmt.Println(HackerPhrase())
Output:
If we calculate the program, we can get to the AI pixel through the redundant XSS matrix!
HackerVerb will return a random hacker verb
Code:
Seed(11) fmt.Println(HackerVerb())
Output:
synthesize
HackeringVerb will return a random hacker ingverb
Code:
Seed(11) fmt.Println(HackeringVerb())
Output:
connecting
HexColor will generate a random hexadecimal color string
Code:
Seed(11) fmt.Println(HexColor())
Output:
#a99fb4
func HipsterParagraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string
HipsterParagraph will generate a random paragraphGenerator Set Paragraph Count Set Sentence Count Set Word Count Set Paragraph Separator
Code:
Seed(11) fmt.Println(HipsterParagraph(3, 5, 12, "\n"))
Output:
Microdosing roof chia echo pickled meditation cold-pressed raw denim fingerstache normcore sriracha pork belly. Wolf try-hard pop-up blog tilde hashtag health butcher waistcoat paleo portland vinegar. Microdosing sartorial blue bottle slow-carb freegan five dollar toast you probably haven't heard of them asymmetrical chia farm-to-table narwhal banjo. Gluten-free blog authentic literally synth vinyl meh ethical health fixie banh mi Yuccie. Try-hard drinking squid seitan cray VHS echo chillwave hammock kombucha food truck sustainable. Pug bushwick hella tote bag cliche direct trade waistcoat yr waistcoat knausgaard pour-over master. Pitchfork jean shorts franzen flexitarian distillery hella meggings austin knausgaard crucifix wolf heirloom. Crucifix food truck you probably haven't heard of them trust fund fixie gentrify pitchfork stumptown mlkshk umami chambray blue bottle. 3 wolf moon swag +1 biodiesel knausgaard semiotics taxidermy meh artisan hoodie +1 blue bottle. Fashion axe forage mixtape Thundercats pork belly whatever 90's beard selfies chambray cred mlkshk. Shabby chic typewriter VHS readymade lo-fi bitters PBR&B gentrify lomo raw denim freegan put a bird on it. Raw denim cliche dreamcatcher pug fixie park trust fund migas fingerstache sriracha +1 mustache. Tilde shoreditch kickstarter franzen dreamcatcher green juice mustache neutra polaroid stumptown organic schlitz. Flexitarian ramps chicharrones kogi lo-fi mustache tilde forage street church-key williamsburg taxidermy. Chia mustache plaid mumblecore squid slow-carb disrupt Thundercats goth shoreditch master direct trade.
HipsterSentence will generate a random sentence
Code:
Seed(11) fmt.Println(HipsterSentence(5))
Output:
Microdosing roof chia echo pickled.
HipsterWord will return a single hipster word
Code:
Seed(11) fmt.Println(HipsterWord())
Output:
microdosing
Hour will generate a random hour - in military time
Code:
Seed(11) fmt.Println(Hour())
Output:
0
IPv4Address will generate a random version 4 ip address
Code:
Seed(11) fmt.Println(IPv4Address())
Output:
152.23.53.100
IPv6Address will generate a random version 6 ip address
Code:
Seed(11) fmt.Println(IPv6Address())
Output:
8898:ee17:bc35:9064:5866:d019:3b95:7857
Image generates a random rgba image
Code:
Seed(11) fmt.Println(Image(1, 1))
Output:
&{[152 23 53 255] 4 (0,0)-(1,1)}
ImageJpeg generates a random rgba jpeg image
Code:
Seed(11) fmt.Println(ImageJpeg(1, 1))
Output:
[255 216 255 219 0 132 0 8 6 6 7 6 5 8 7 7 7 9 9 8 10 12 20 13 12 11 11 12 25 18 19 15 20 29 26 31 30 29 26 28 28 32 36 46 39 32 34 44 35 28 28 40 55 41 44 48 49 52 52 52 31 39 57 61 56 50 60 46 51 52 50 1 9 9 9 12 11 12 24 13 13 24 50 33 28 33 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 255 192 0 17 8 0 1 0 1 3 1 34 0 2 17 1 3 17 1 255 196 1 162 0 0 1 5 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 16 0 2 1 3 3 2 4 3 5 5 4 4 0 0 1 125 1 2 3 0 4 17 5 18 33 49 65 6 19 81 97 7 34 113 20 50 129 145 161 8 35 66 177 193 21 82 209 240 36 51 98 114 130 9 10 22 23 24 25 26 37 38 39 40 41 42 52 53 54 55 56 57 58 67 68 69 70 71 72 73 74 83 84 85 86 87 88 89 90 99 100 101 102 103 104 105 106 115 116 117 118 119 120 121 122 131 132 133 134 135 136 137 138 146 147 148 149 150 151 152 153 154 162 163 164 165 166 167 168 169 170 178 179 180 181 182 183 184 185 186 194 195 196 197 198 199 200 201 202 210 211 212 213 214 215 216 217 218 225 226 227 228 229 230 231 232 233 234 241 242 243 244 245 246 247 248 249 250 1 0 3 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 17 0 2 1 2 4 4 3 4 7 5 4 4 0 1 2 119 0 1 2 3 17 4 5 33 49 6 18 65 81 7 97 113 19 34 50 129 8 20 66 145 161 177 193 9 35 51 82 240 21 98 114 209 10 22 36 52 225 37 241 23 24 25 26 38 39 40 41 42 53 54 55 56 57 58 67 68 69 70 71 72 73 74 83 84 85 86 87 88 89 90 99 100 101 102 103 104 105 106 115 116 117 118 119 120 121 122 130 131 132 133 134 135 136 137 138 146 147 148 149 150 151 152 153 154 162 163 164 165 166 167 168 169 170 178 179 180 181 182 183 184 185 186 194 195 196 197 198 199 200 201 202 210 211 212 213 214 215 216 217 218 226 227 228 229 230 231 232 233 234 242 243 244 245 246 247 248 249 250 255 218 0 12 3 1 0 2 17 3 17 0 63 0 224 40 162 138 196 251 115 255 217]
ImagePng generates a random rgba png image
Code:
Seed(11) fmt.Println(ImagePng(1, 1))
Output:
[137 80 78 71 13 10 26 10 0 0 0 13 73 72 68 82 0 0 0 1 0 0 0 1 8 2 0 0 0 144 119 83 222 0 0 0 16 73 68 65 84 120 156 98 154 33 110 10 8 0 0 255 255 2 55 0 231 28 250 86 54 0 0 0 0 73 69 78 68 174 66 96 130]
ImageURL will generate a random Image Based Upon Height And Width. https://picsum.photos/
Code:
Seed(11) fmt.Println(ImageURL(640, 480))
Output:
https://picsum.photos/640/480
Int16 will generate a random int16 value
Code:
Seed(11) fmt.Println(Int16())
Output:
2200
Int32 will generate a random int32 value
Code:
Seed(11) fmt.Println(Int32())
Output:
-1072427943
Int64 will generate a random int64 value
Code:
Seed(11) fmt.Println(Int64())
Output:
-8379641344161477543
Int8 will generate a random Int8 value
Code:
Seed(11) fmt.Println(Int8())
Output:
24
func JSON(jo *JSONOptions) ([]byte, error)
JSON generates an object or an array of objects in json format
Code:
Seed(11) value, err := JSON(&JSONOptions{ Type: "array", Fields: []Field{ {Name: "id", Function: "autoincrement"}, {Name: "first_name", Function: "firstname"}, {Name: "last_name", Function: "lastname"}, {Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}}, }, RowCount: 3, Indent: true, }) if err != nil { fmt.Println(err) } fmt.Println(string(value))
Output:
[ { "id": 1, "first_name": "Markus", "last_name": "Moen", "password": "Dc0VYXjkWABx" }, { "id": 2, "first_name": "Osborne", "last_name": "Hilll", "password": "XPJ9OVNbs5lm" }, { "id": 3, "first_name": "Mertie", "last_name": "Halvorson", "password": "eyl3bhwfV8wA" } ]
Code:
Seed(11) value, err := JSON(&JSONOptions{ Type: "object", Fields: []Field{ {Name: "first_name", Function: "firstname"}, {Name: "last_name", Function: "lastname"}, {Name: "address", Function: "address"}, {Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}}, }, Indent: true, }) if err != nil { fmt.Println(err) } fmt.Println(string(value))
Output:
{ "first_name": "Markus", "last_name": "Moen", "address": { "address": "4599 Dale ton, Lake Carroll, Mississippi 90635", "street": "4599 Dale ton", "city": "Lake Carroll", "state": "Mississippi", "zip": "90635", "country": "Saint Pierre and Miquelon", "latitude": 22.008873, "longitude": 158.531956 }, "password": "YjJbXclnVN0H" }
JobDescriptor will generate a random job descriptor string
Code:
Seed(11) fmt.Println(JobDescriptor())
Output:
Central
JobLevel will generate a random job level string
Code:
Seed(11) fmt.Println(JobLevel())
Output:
Assurance
JobTitle will generate a random job title string
Code:
Seed(11) fmt.Println(JobTitle())
Output:
Director
Language will return a random language
Code:
Seed(11) fmt.Println(Language())
Output:
Kazakh
LanguageAbbreviation will return a random language abbreviation
Code:
Seed(11) fmt.Println(LanguageAbbreviation())
Output:
kk
LastName will generate a random last name
Code:
Seed(11) fmt.Println(LastName())
Output:
Daniel
Latitude will generate a random latitude float64
Code:
Seed(11) fmt.Println(Latitude())
Output:
-73.534057
LatitudeInRange will generate a random latitude within the input range
Code:
Seed(11) lat, _ := LatitudeInRange(21, 42) fmt.Println(lat)
Output:
22.921026
Letter will generate a single random lower case ASCII letter
Code:
Seed(11) fmt.Println(Letter())
Output:
g
LetterN will generate a random ASCII string with length N
Code:
Seed(11) fmt.Println(LetterN(10))
Output:
gbRMaRxHki
Lexify will replace ? will random generated letters
Code:
Seed(11) fmt.Println(Lexify("?????"))
Output:
gbRMa
LogLevel will generate a random log level See data/LogLevels for list of available levels
Code:
Seed(11)
fmt.Println(LogLevel("")) // This will also use general
fmt.Println(LogLevel("syslog"))
fmt.Println(LogLevel("apache"))
Output:
error debug trace1-8
Longitude will generate a random longitude float64
Code:
Seed(11) fmt.Println(Longitude())
Output:
-147.068113
LongitudeInRange will generate a random longitude within the input range
Code:
Seed(11) long, _ := LongitudeInRange(-10, 10) fmt.Println(long)
Output:
-8.170451
func LoremIpsumParagraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string
LoremIpsumParagraph will generate a random paragraphGenerator
Code:
Seed(11) fmt.Println(LoremIpsumParagraph(3, 5, 12, "\n"))
Output:
Quia quae repellat consequatur quidem nisi quo qui voluptatum accusantium quisquam amet. Quas et ut non dolorem ipsam aut enim assumenda mollitia harum ut. Dicta similique veniam nulla voluptas at excepturi non ad maxime at non. Eaque hic repellat praesentium voluptatem qui consequuntur dolor iusto autem velit aut. Fugit tempore exercitationem harum consequatur voluptatum modi minima aut eaque et et. Aut ea voluptatem dignissimos expedita odit tempore quod aut beatae ipsam iste. Minus voluptatibus dolorem maiores eius sed nihil vel enim odio voluptatem accusamus. Natus quibusdam temporibus tenetur cumque sint necessitatibus dolorem ex ducimus iusto ex. Voluptatem neque dicta explicabo officiis et ducimus sit ut ut praesentium pariatur. Illum molestias nisi at dolore ut voluptatem accusantium et fugiat et ut. Explicabo incidunt reprehenderit non quia dignissimos recusandae vitae soluta quia et quia. Aut veniam voluptas consequatur placeat sapiente non eveniet voluptatibus magni velit eum. Nobis vel repellendus sed est qui autem laudantium quidem quam ullam consequatur. Aut iusto ut commodi similique quae voluptatem atque qui fugiat eum aut. Quis distinctio consequatur voluptatem vel aliquid aut laborum facere officiis iure tempora.
LoremIpsumSentence will generate a random sentence
Code:
Seed(11) fmt.Println(LoremIpsumSentence(5))
Output:
Quia quae repellat consequatur quidem.
LoremIpsumWord will generate a random word
Code:
Seed(11) fmt.Println(LoremIpsumWord())
Output:
quia
Lunch will return a random lunch name
Code:
Seed(11) fmt.Println(Lunch())
Output:
No bake hersheys bar pie
MacAddress will generate a random mac address
Code:
Seed(11) fmt.Println(MacAddress())
Output:
e1:74:cb:01:77:91
Map will generate a random set of map data
Code:
Seed(11) fmt.Println(Map())
Output:
map[approach:map[mind:[arrival should resolve outcome hurt]] arrive:Coordinator consult:respond context:9285735 water:5081652]
Minute will generate a random minute
Code:
Seed(11) fmt.Println(Minute())
Output:
0
Month will generate a random month string
Code:
Seed(11) fmt.Println(Month())
Output:
January
Name will generate a random First and Last Name
Code:
Seed(11) fmt.Println(Name())
Output:
Markus Moen
NamePrefix will generate a random name prefix
Code:
Seed(11) fmt.Println(NamePrefix())
Output:
Mr.
NameSuffix will generate a random name suffix
Code:
Seed(11) fmt.Println(NameSuffix())
Output:
Jr.
NanoSecond will generate a random nano second
Code:
Seed(11) fmt.Println(NanoSecond())
Output:
196446360
Noun will generate a random noun
Code:
Seed(11) fmt.Println(Noun())
Output:
foot
Number will generate a random number between given min And max
Code:
Seed(11) fmt.Println(Number(50, 23456))
Output:
14866
Numerify will replace # with random numerical values
Code:
Seed(11) fmt.Println(Numerify("###-###-####"))
Output:
613-645-9948
OperaUserAgent will generate a random opera browser user agent string
Code:
Seed(11) fmt.Println(OperaUserAgent())
Output:
Opera/8.39 (Macintosh; U; PPC Mac OS X 10_8_7; en-US) Presto/2.9.335 Version/10.00
Paragraph will generate a random paragraphGenerator
Code:
Seed(11) fmt.Println(Paragraph(3, 5, 12, "\n"))
Output:
Interpret context record river mind press self should compare property outcome divide. Combine approach sustain consult discover explanation direct address church husband seek army. Begin own act welfare replace press suspect stay link place manchester specialist. Arrive price satisfy sign force application hair train provide basis right pay. Close mark teacher strengthen information attempt head touch aim iron tv take. Handle wait begin look speech trust cancer visit capacity disease chancellor clean. Race aim function gain couple push faith enjoy admit ring attitude develop. Edge game prevent cast mill favour father star live search aim guess. West heart item adopt compete equipment miss output report communicate model cabinet. Seek worker variety step argue air improve give succeed relief artist suffer. Hide finish insist knowledge thatcher make research chance structure proportion husband implement. Town crown restaurant cost material compete lady climb football region discussion order. Place lee market ice like display mind stress compete weather station raise. Democracy college major recall struggle use cut intention accept period generation strike. Benefit defend recommend conclude justify result depend succeed address owner fill interpret.
Password will generate a random password. Minimum number length of 5 if less than.
Code:
Seed(11) fmt.Println(Password(true, false, false, false, false, 32)) fmt.Println(Password(false, true, false, false, false, 32)) fmt.Println(Password(false, false, true, false, false, 32)) fmt.Println(Password(false, false, false, true, false, 32)) fmt.Println(Password(true, true, true, true, true, 32)) fmt.Println(Password(true, true, true, true, true, 4))
Output:
vodnqxzsuptgehrzylximvylxzoywexw ZSRQWJFJWCSTVGXKYKWMLIAFGFELFJRG 61718615932495608398906260648432 @$,@#:,(,).{?:%?)>*..<=};#$(:{== CkF{wwb:?Kb},w?vdz{Zox C&>Prt99: j ;9X
PetName will return a random fun pet name
Code:
Seed(11) fmt.Println(PetName())
Output:
Ozzy Pawsborne
Phone will generate a random phone number string
Code:
Seed(11) fmt.Println(Phone())
Output:
6136459948
PhoneFormatted will generate a random phone number string
Code:
Seed(11) fmt.Println(PhoneFormatted())
Output:
136-459-9489
Phrase will return a random dictionary phrase
Code:
Seed(11) fmt.Println(Phrase())
Output:
shut the front door
Preposition will generate a random preposition
Code:
Seed(11) fmt.Println(Preposition())
Output:
down
Price will take in a min and max value and return a formatted price
Code:
Seed(11) fmt.Printf("%.2f", Price(0.8618, 1000))
Output:
92.26
ProgrammingLanguage will return a random programming language
Code:
Seed(464) fmt.Println(ProgrammingLanguage())
Output:
Go
ProgrammingLanguageBest will return a random programming language
Code:
Seed(11) fmt.Println(ProgrammingLanguageBest())
Output:
Go
Question will return a random question
Code:
Seed(11) fmt.Println(Question())
Output:
Roof chia echo?
Quote will return a random quote from a random person
Code:
Seed(11) fmt.Println(Quote())
Output:
"Roof chia echo." - Lura Lockman
RGBColor will generate a random int slice color
Code:
Seed(11) fmt.Println(RGBColor())
Output:
[152 23 53]
RandomInt will take in a slice of int and return a randomly selected value
Code:
Seed(11) ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657} fmt.Println(RandomInt(ints))
Output:
52
RandomString will take in a slice of string and return a randomly selected value
Code:
Seed(11) fmt.Println(RandomString([]string{"hello", "world"}))
Output:
hello
RandomUint will take in a slice of uint and return a randomly selected value
Code:
Seed(11) ints := []uint{52, 854, 941, 74125, 8413, 777, 89416, 841657} fmt.Println(RandomUint(ints))
Output:
52
Regex will generate a string based upon a RE2 syntax
Code:
Seed(11) fmt.Println(Regex("[abcdef]{5}")) fmt.Println(Regex("[[:upper:]]{5}")) fmt.Println(Regex("(hello|world|whats|up)")) fmt.Println(Regex(`^[a-z]{5,10}@[a-z]{5,10}\.(com|net|org)$`))
Output:
affec RXHKI up ptapwy@dnsmkgtl.com
RemoveFuncLookup will remove a function from lookup
SSN will generate a random Social Security Number
Code:
Seed(11) fmt.Println(SSN())
Output:
296446360
SafariUserAgent will generate a random safari browser user agent string
Code:
Seed(11) fmt.Println(SafariUserAgent())
Output:
Mozilla/5.0 (iPad; CPU OS 8_3_2 like Mac OS X; en-US) AppleWebKit/531.15.6 (KHTML, like Gecko) Version/4.0.5 Mobile/8B120 Safari/6531.15.6
SafeColor will generate a random safe color string
Code:
Seed(11) fmt.Println(SafeColor())
Output:
black
Second will generate a random second
Code:
Seed(11) fmt.Println(Second())
Output:
0
Seed will set the global random value. Setting seed to 0 will use crypto/rand
Sentence will generate a random sentence
Code:
Seed(11) fmt.Println(Sentence(5))
Output:
Interpret context record river mind.
SetGlobalFaker will allow you to set what type of faker is globally used. Defailt is math/rand
Code:
cryptoFaker := NewCrypto() SetGlobalFaker(cryptoFaker)
func ShuffleAnySlice(v interface{})
ShuffleAnySlice takes in a slice and outputs it in a random order
Code:
Seed(11) strings := []string{"happy", "times", "for", "everyone", "have", "a", "good", "day"} ShuffleAnySlice(strings) fmt.Println(strings) ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657} ShuffleAnySlice(ints) fmt.Println(ints)
Output:
[good everyone have for times a day happy] [777 74125 941 854 89416 52 8413 841657]
ShuffleInts will randomize a slice of ints
Code:
Seed(11) ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657} ShuffleInts(ints) fmt.Println(ints)
Output:
[74125 777 941 89416 8413 854 52 841657]
ShuffleStrings will randomize a slice of strings
Code:
Seed(11) strings := []string{"happy", "times", "for", "everyone", "have", "a", "good", "day"} ShuffleStrings(strings) fmt.Println(strings)
Output:
[good everyone have for times a day happy]
Snack will return a random snack name
Code:
Seed(11) fmt.Println(Snack())
Output:
Hoisin marinated wing pieces
State will generate a random state string
Code:
Seed(11) fmt.Println(State())
Output:
Hawaii
StateAbr will generate a random abbreviated state string
Code:
Seed(11) fmt.Println(StateAbr())
Output:
OR
Street will generate a random address street string
Code:
Seed(11) fmt.Println(Street())
Output:
364 East Rapids borough
StreetName will generate a random address street name string
Code:
Seed(11) fmt.Println(StreetName())
Output:
View
StreetNumber will generate a random address street number string
Code:
Seed(11) fmt.Println(StreetNumber())
Output:
13645
StreetPrefix will generate a random address street prefix string
Code:
Seed(11) fmt.Println(StreetPrefix())
Output:
Lake
StreetSuffix will generate a random address street suffix string
Code:
Seed(11) fmt.Println(StreetSuffix())
Output:
land
func Struct(v interface{})
Struct fills in exported elements of a struct with random data based on the value of `fake` tag of exported elements. Use `fake:"skip"` to explicitly skip an element. All built-in types are supported, with templating support for string types.
Teams takes in an array of people and team names and randomly places the people into teams as evenly as possible
Code:
Seed(11) fmt.Println(Teams( []string{"Billy", "Sharon", "Jeff", "Connor", "Steve", "Justin", "Fabian", "Robert"}, []string{"Team 1", "Team 2", "Team 3"}, ))
Output:
map[Team 1:[Fabian Connor Steve] Team 2:[Jeff Sharon Justin] Team 3:[Robert Billy]]
TimeZone will select a random timezone string
Code:
Seed(11) fmt.Println(TimeZone())
Output:
Kaliningrad Standard Time
TimeZoneAbv will select a random timezone abbreviation string
Code:
Seed(11) fmt.Println(TimeZoneAbv())
Output:
KST
TimeZoneFull will select a random full timezone string
Code:
Seed(11) fmt.Println(TimeZoneFull())
Output:
(UTC+03:00) Kaliningrad, Minsk
TimeZoneOffset will select a random timezone offset
Code:
Seed(11) fmt.Println(TimeZoneOffset())
Output:
3
TimeZoneRegion will select a random region style timezone string, e.g. "America/Chicago"
Code:
Seed(11) fmt.Println(TimeZoneRegion())
Output:
America/Vancouver
URL will generate a random url string
Code:
Seed(11) fmt.Println(URL())
Output:
http://www.principalproductize.biz/target
UUID (version 4) will generate a random unique identifier based upon random numbers Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Code:
Seed(11) fmt.Println(UUID())
Output:
590c1440-9888-45b0-bd51-a817ee07c3f2
Uint16 will generate a random uint16 value
Code:
Seed(11) fmt.Println(Uint16())
Output:
34968
Uint32 will generate a random uint32 value
Code:
Seed(11) fmt.Println(Uint32())
Output:
1075055705
Uint64 will generate a random uint64 value
Code:
Seed(11) fmt.Println(Uint64())
Output:
843730692693298265
Uint8 will generate a random uint8 value
Code:
Seed(11) fmt.Println(Uint8())
Output:
152
UserAgent will generate a random broswer user agent
Code:
Seed(11) fmt.Println(UserAgent())
Output:
Mozilla/5.0 (Windows NT 5.0) AppleWebKit/5362 (KHTML, like Gecko) Chrome/37.0.834.0 Mobile Safari/5362
Username will generate a random username based upon picking a random lastname and random numbers at the end
Code:
Seed(11) fmt.Println(Username())
Output:
Daniel1364
Vegetable will return a random vegetable name
Code:
Seed(11) fmt.Println(Vegetable())
Output:
Amaranth Leaves
Verb will generate a random verb
Code:
Seed(11) fmt.Println(Verb())
Output:
release
WeekDay will generate a random weekday string (Monday-Sunday)
Code:
Seed(11) fmt.Println(WeekDay())
Output:
Friday
Word will generate a random word
Code:
Seed(11) fmt.Println(Word())
Output:
interpret
func XML(xo *XMLOptions) ([]byte, error)
XML generates an object or an array of objects in json format
Code:
Seed(11) value, err := XML(&XMLOptions{ Type: "array", RootElement: "xml", RecordElement: "record", RowCount: 2, Indent: true, Fields: []Field{ {Name: "first_name", Function: "firstname"}, {Name: "last_name", Function: "lastname"}, {Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}}, }, }) if err != nil { fmt.Println(err) } fmt.Println(string(value))
Output:
<xml> <record> <first_name>Markus</first_name> <last_name>Moen</last_name> <password>Dc0VYXjkWABx</password> </record> <record> <first_name>Osborne</first_name> <last_name>Hilll</last_name> <password>XPJ9OVNbs5lm</password> </record> </xml>
Code:
Seed(11) value, err := XML(&XMLOptions{ Type: "single", RootElement: "xml", RecordElement: "record", RowCount: 2, Indent: true, Fields: []Field{ {Name: "first_name", Function: "firstname"}, {Name: "last_name", Function: "lastname"}, {Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}}, }, }) if err != nil { fmt.Println(err) } fmt.Println(string(value))
Output:
<xml> <first_name>Markus</first_name> <last_name>Moen</last_name> <password>Dc0VYXjkWABx</password> </xml>
Year will generate a random year between 1900 - current year
Code:
Seed(11) fmt.Println(Year())
Output:
1908
Zip will generate a random Zip code string
Code:
Seed(11) fmt.Println(Zip())
Output:
13645
type AddressInfo struct { Address string `json:"address" xml:"address"` Street string `json:"street" xml:"street"` City string `json:"city" xml:"city"` State string `json:"state" xml:"state"` Zip string `json:"zip" xml:"zip"` Country string `json:"country" xml:"country"` Latitude float64 `json:"latitude" xml:"latitude"` Longitude float64 `json:"longitude" xml:"longitude"` }
AddressInfo is a struct full of address information
func Address() *AddressInfo
Address will generate a struct of address information
Code:
Seed(11) address := Address() fmt.Println(address.Address) fmt.Println(address.Street) fmt.Println(address.City) fmt.Println(address.State) fmt.Println(address.Zip) fmt.Println(address.Country) fmt.Println(address.Latitude) fmt.Println(address.Longitude)
Output:
364 East Rapids borough, Rutherfordstad, New Jersey 36906 364 East Rapids borough Rutherfordstad New Jersey 36906 South Africa 23.058758 89.022594
type CSVOptions struct { Delimiter string `json:"delimiter" xml:"delimiter"` RowCount int `json:"row_count" xml:"row_count"` Fields []Field `json:"fields" xml:"fields"` }
CSVOptions defines values needed for csv generation
type CarInfo struct { Type string `json:"type" xml:"type"` Fuel string `json:"fuel" xml:"fuel"` Transmission string `json:"transmission" xml:"transmission"` Brand string `json:"brand" xml:"brand"` Model string `json:"model" xml:"model"` Year int `json:"year" xml:"year"` }
CarInfo is a struct dataset of all car information
Car will generate a struct with car information
Code:
Seed(11) car := Car() fmt.Println(car.Brand) fmt.Println(car.Fuel) fmt.Println(car.Model) fmt.Println(car.Transmission) fmt.Println(car.Type) fmt.Println(car.Year)
Output:
Fiat Gasoline Freestyle Fwd Automatic Passenger car mini 1967
type ContactInfo struct { Phone string `json:"phone" xml:"phone"` Email string `json:"email" xml:"email"` }
ContactInfo struct full of contact info
func Contact() *ContactInfo
Contact will generate a struct with information randomly populated contact information
Code:
Seed(11) contact := Contact() fmt.Println(contact.Phone) fmt.Println(contact.Email)
Output:
6136459948 carolecarroll@bosco.com
type CreditCardInfo struct { Type string `json:"type" xml:"type"` Number string `json:"number" xml:"number"` Exp string `json:"exp" xml:"exp"` Cvv string `json:"cvv" xml:"cvv"` }
CreditCardInfo is a struct containing credit variables
func CreditCard() *CreditCardInfo
CreditCard will generate a struct full of credit card information
Code:
Seed(11) ccInfo := CreditCard() fmt.Println(ccInfo.Type) fmt.Println(ccInfo.Number) fmt.Println(ccInfo.Exp) fmt.Println(ccInfo.Cvv)
Output:
UnionPay 4645994899536906358 11/22 259
type CreditCardOptions struct { Types []string `json:"types"` Bins []string `json:"bins"` // optional parameter of prepended numbers Gaps bool `json:"gaps"` }
CreditCardOptions is the options for credit card number
type CurrencyInfo struct { Short string `json:"short" xml:"short"` Long string `json:"long" xml:"long"` }
CurrencyInfo is a struct of currency information
func Currency() *CurrencyInfo
Currency will generate a struct with random currency information
Code:
Seed(11) currency := Currency() fmt.Printf("%s - %s", currency.Short, currency.Long)
Output:
IQD - Iraq Dinar
Faker struct is the primary struct for using localized.
Code:
f := New(11) type Foo struct { Bar string Int int Name string `fake:"{firstname}"` Number string `fake:"{number:1,10}"` Skip *string `fake:"skip"` } type FooMany struct { Foos []Foo `fakesize:"1"` Names []string `fake:"{firstname}" fakesize:"3"` } var fm FooMany f.Struct(&fm) fmt.Printf("%v\n", fm.Foos) fmt.Printf("%v\n", fm.Names)
Output:
[{bRMaRxHki -8576773003117070818 Carole 6 <nil>}] [Dawn Zachery Amie]
Code:
f := New(11) type Foo struct { Bar string Int int Pointer *int Name string `fake:"{firstname}"` Number string `fake:"{number:1,10}"` Skip *string `fake:"skip"` } var foo Foo f.Struct(&foo) fmt.Printf("%s\n", foo.Bar) fmt.Printf("%d\n", foo.Int) fmt.Printf("%d\n", *foo.Pointer) fmt.Printf("%v\n", foo.Name) fmt.Printf("%v\n", foo.Number) fmt.Printf("%v\n", foo.Skip)
Output:
bRMaRxHki -8576773003117070818 -7054675846543980602 Enrique 4 <nil>
New will utilize math/rand for concurrent random usage. Setting seed to 0 will use crypto/rand for the initial seed number.
Code:
// Create new pseudo random faker struct and set initial seed fake := New(11) // All global functions are also available in the structs methods fmt.Println("Name:", fake.Name()) fmt.Println("Email:", fake.Email()) fmt.Println("Phone:", fake.Phone())
Output:
Name: Markus Moen Email: alaynawuckert@kozey.biz Phone: 9948995369
NewCrypto will utilize crypto/rand for concurrent pseudo random usage.
Code:
// Create new crypto faker struct fake := NewCrypto() // All global functions are also available in the structs methods fmt.Println("Name:", fake.Name()) fmt.Println("Email:", fake.Email()) fmt.Println("Phone:", fake.Phone()) // Cannot output example as crypto/rand cant be predicted
NewCustom will utilize a custom rand.Source64 for concurrent random usage See https://golang.org/src/math/rand/rand.go for required interface methods
Code:
// Setup stuct and methods required to meet interface needs // type customRand struct {} // func (c *customRand) Seed(seed int64) {} // func (c *customRand) Uint64() uint64 { return 8675309 } // func (c *customRand) Int63() int64 { return int64(c.Uint64() & ^uint64(1<<63)) } // Create new custom faker struct fake := NewCustom(&customRand{}) // All global functions are also available in the structs methods fmt.Println("Name:", fake.Name()) fmt.Println("Email:", fake.Email()) fmt.Println("Phone:", fake.Phone())
Output:
Name: Aaliyah Abbott Email: aaliyahabbott@abbott.com Phone: 1000000000
AchAccount will generate a 12 digit account number
Code:
f := New(11) fmt.Println(f.AchAccount())
Output:
413645994899
AchRouting will generate a 9 digit routing number
Code:
f := New(11) fmt.Println(f.AchRouting())
Output:
713645994
func (f *Faker) Address() *AddressInfo
Address will generate a struct of address information
Code:
f := New(11) address := f.Address() fmt.Println(address.Address) fmt.Println(address.Street) fmt.Println(address.City) fmt.Println(address.State) fmt.Println(address.Zip) fmt.Println(address.Country) fmt.Println(address.Latitude) fmt.Println(address.Longitude)
Output:
364 East Rapids borough, Rutherfordstad, New Jersey 36906 364 East Rapids borough Rutherfordstad New Jersey 36906 South Africa 23.058758 89.022594
Adjective will generate a random adjective
Code:
f := New(11) fmt.Println(f.Adjective())
Output:
genuine
Adverb will generate a random adverb
Code:
f := New(11) fmt.Println(f.Adverb())
Output:
smoothly
Animal will return a random animal
Code:
f := New(11) fmt.Println(f.Animal())
Output:
elk
AnimalType will return a random animal type
Code:
f := New(11) fmt.Println(f.AnimalType())
Output:
amphibians
AppAuthor will generate a random company or person name
Code:
f := New(11) fmt.Println(f.AppAuthor())
Output:
Qado Energy, Inc.
AppName will generate a random app name
Code:
f := New(11) fmt.Println(f.AppName())
Output:
Parkrespond
AppVersion will generate a random app version
Code:
f := New(11) fmt.Println(f.AppVersion())
Output:
1.12.14
BS will generate a random company bs string
Code:
f := New(11) fmt.Println(f.BS())
Output:
front-end
BeerAlcohol will return a random beer alcohol level between 2.0 and 10.0
Code:
f := New(11) fmt.Println(f.BeerAlcohol())
Output:
2.7%
BeerBlg will return a random beer blg between 5.0 and 20.0
Code:
f := New(11) fmt.Println(f.BeerBlg())
Output:
6.4°Blg
BeerHop will return a random beer hop
Code:
f := New(11) fmt.Println(f.BeerHop())
Output:
Glacier
BeerIbu will return a random beer ibu value between 10 and 100
Code:
f := New(11) fmt.Println(f.BeerIbu())
Output:
29 IBU
BeerMalt will return a random beer malt
Code:
f := New(11) fmt.Println(f.BeerMalt())
Output:
Munich
BeerName will return a random beer name
Code:
f := New(11) fmt.Println(f.BeerName())
Output:
Duvel
BeerStyle will return a random beer style
Code:
f := New(11) fmt.Println(f.BeerStyle())
Output:
European Amber Lager
BeerYeast will return a random beer yeast
Code:
f := New(11) fmt.Println(f.BeerYeast())
Output:
1388 - Belgian Strong Ale
BitcoinAddress will generate a random bitcoin address consisting of numbers, upper and lower characters
Code:
f := New(11) fmt.Println(f.BitcoinAddress())
Output:
1lWLbxojXq6BqWX7X60VkcDIvYA
BitcoinPrivateKey will generate a random bitcoin private key base58 consisting of numbers, upper and lower characters
Code:
f := New(11) fmt.Println(f.BitcoinPrivateKey())
Output:
5KWjEJ7SnBNJyDjdPUjLuYByYzM9rG1trax8c2NTSBtv7YtR57v
Bool will generate a random boolean value
Code:
f := New(11) fmt.Println(f.Bool())
Output:
false
Breakfast will return a random breakfast name
Code:
f := New(11) fmt.Println(f.Breakfast())
Output:
Blueberry banana happy face pancakes
BuzzWord will generate a random company buzz word string
Code:
f := New(11) fmt.Println(f.BuzzWord())
Output:
disintermediate
func (f *Faker) CSV(co *CSVOptions) ([]byte, error)
CSV generates an object or an array of objects in json format
Code:
f := New(11) value, err := f.CSV(&CSVOptions{ RowCount: 3, Fields: []Field{ {Name: "id", Function: "autoincrement"}, {Name: "first_name", Function: "firstname"}, {Name: "last_name", Function: "lastname"}, {Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}}, }, }) if err != nil { fmt.Println(err) } fmt.Println(string(value))
Output:
id,first_name,last_name,password 1,Markus,Moen,Dc0VYXjkWABx 2,Osborne,Hilll,XPJ9OVNbs5lm
Car will generate a struct with car information
Code:
f := New(11) car := f.Car() fmt.Println(car.Brand) fmt.Println(car.Fuel) fmt.Println(car.Model) fmt.Println(car.Transmission) fmt.Println(car.Type) fmt.Println(car.Year)
Output:
Fiat Gasoline Freestyle Fwd Automatic Passenger car mini 1967
CarFuelType will return a random fuel type
Code:
f := New(11) fmt.Println(f.CarFuelType())
Output:
CNG
CarMaker will return a random car maker
Code:
f := New(11) fmt.Println(f.CarMaker())
Output:
Nissan
CarModel will return a random car model
Code:
f := New(11) fmt.Println(f.CarModel())
Output:
Aveo
CarTransmissionType will return a random transmission type
Code:
f := New(11) fmt.Println(f.CarTransmissionType())
Output:
Manual
CarType will generate a random car type string
Code:
f := New(11) fmt.Println(f.CarType())
Output:
Passenger car mini
Cat will return a random cat breed
Code:
f := New(11) fmt.Println(f.Cat())
Output:
Sokoke
ChromeUserAgent will generate a random chrome browser user agent string
Code:
f := New(11) fmt.Println(f.ChromeUserAgent())
Output:
Mozilla/5.0 (X11; Linux i686) AppleWebKit/5312 (KHTML, like Gecko) Chrome/39.0.836.0 Mobile Safari/5312
City will generate a random city string
Code:
f := New(11) fmt.Println(f.City())
Output:
Marcelside
Color will generate a random color string
Code:
f := New(11) fmt.Println(f.Color())
Output:
MediumOrchid
Company will generate a random company name string
Code:
f := New(11) fmt.Println(f.Company())
Output:
ClearHealthCosts
CompanySuffix will generate a random company suffix string
Code:
f := New(11) fmt.Println(f.CompanySuffix())
Output:
Inc
func (f *Faker) Contact() *ContactInfo
Contact will generate a struct with information randomly populated contact information
Code:
f := New(11) contact := f.Contact() fmt.Println(contact.Phone) fmt.Println(contact.Email)
Output:
6136459948 carolecarroll@bosco.com
Country will generate a random country string
Code:
f := New(11) fmt.Println(f.Country())
Output:
Tajikistan
CountryAbr will generate a random abbreviated country string
Code:
f := New(11) fmt.Println(f.CountryAbr())
Output:
FI
func (f *Faker) CreditCard() *CreditCardInfo
CreditCard will generate a struct full of credit card information
Code:
f := New(11) ccInfo := f.CreditCard() fmt.Println(ccInfo.Type) fmt.Println(ccInfo.Number) fmt.Println(ccInfo.Exp) fmt.Println(ccInfo.Cvv)
Output:
UnionPay 4645994899536906358 11/22 259
CreditCardCvv will generate a random CVV number Its a string because you could have 017 as an exp date
Code:
f := New(11) fmt.Println(f.CreditCardCvv())
Output:
513
CreditCardExp will generate a random credit card expiration date string Exp date will always be a future date
Code:
f := New(11) fmt.Println(f.CreditCardExp())
Output:
01/23
func (f *Faker) CreditCardNumber(cco *CreditCardOptions) string
CreditCardNumber will generate a random luhn credit card number
Code:
f := New(11) fmt.Println(f.CreditCardNumber(nil)) fmt.Println(f.CreditCardNumber(&CreditCardOptions{Types: []string{"visa", "discover"}})) fmt.Println(f.CreditCardNumber(&CreditCardOptions{Bins: []string{"4111"}})) fmt.Println(f.CreditCardNumber(&CreditCardOptions{Gaps: true}))
Output:
4364599489953690649 6011425914583029 4111020276132178 2131 0889 9822 7212
CreditCardType will generate a random credit card type string
Code:
f := New(11) fmt.Println(f.CreditCardType())
Output:
Visa
func (f *Faker) Currency() *CurrencyInfo
Currency will generate a struct with random currency information
Code:
f := New(11) currency := f.Currency() fmt.Printf("%s - %s", currency.Short, currency.Long)
Output:
IQD - Iraq Dinar
CurrencyLong will generate a random long currency name
Code:
f := New(11) fmt.Println(f.CurrencyLong())
Output:
Iraq Dinar
CurrencyShort will generate a random short currency value
Code:
f := New(11) fmt.Println(f.CurrencyShort())
Output:
IQD
Date will generate a random time.Time struct
Code:
f := New(11) fmt.Println(f.Date())
Output:
1908-12-07 04:14:25.685339029 +0000 UTC
DateRange will generate a random time.Time struct between a start and end date
Code:
f := New(11)
fmt.Println(f.DateRange(time.Unix(0, 484633944473634951), time.Unix(0, 1431318744473668209))) // May 10, 1985 years to May 10, 2015
Output:
2012-02-04 14:10:37.166933216 +0000 UTC
Day will generate a random day between 1 - 31
Code:
f := New(11) fmt.Println(f.Day())
Output:
12
Dessert will return a random dessert name
Code:
f := New(11) fmt.Println(f.Dessert())
Output:
French napoleons
Digit will generate a single ASCII digit
Code:
f := New(11) fmt.Println(f.Digit())
Output:
0
DigitN will generate a random string of length N consists of ASCII digits (note it can start with 0).
Code:
f := New(11) fmt.Println(f.DigitN(10))
Output:
0136459948
Dinner will return a random dinner name
Code:
f := New(11) fmt.Println(f.Dinner())
Output:
Wild addicting dip
Dog will return a random dog breed
Code:
f := New(11) fmt.Println(f.Dog())
Output:
Norwich Terrier
DomainName will generate a random url domain name
Code:
f := New(11) fmt.Println(f.DomainName())
Output:
centraltarget.biz
DomainSuffix will generate a random domain suffix
Code:
f := New(11) fmt.Println(f.DomainSuffix())
Output:
org
Email will generate a random email string
Code:
f := New(11) fmt.Println(f.Email())
Output:
markusmoen@pagac.net
Emoji will return a random fun emoji
Code:
f := New(11) fmt.Println(f.Emoji())
Output:
🧛
EmojiAlias will return a random fun emoji alias
Code:
f := New(11) fmt.Println(f.EmojiAlias())
Output:
deaf_person
EmojiCategory will return a random fun emoji category
Code:
f := New(11) fmt.Println(f.EmojiCategory())
Output:
Food & Drink
EmojiDescription will return a random fun emoji description
Code:
f := New(11) fmt.Println(f.EmojiDescription())
Output:
confetti ball
EmojiTag will return a random fun emoji tag
Code:
f := New(11) fmt.Println(f.EmojiTag())
Output:
strong
FarmAnimal will return a random animal that usually lives on a farm
Code:
f := New(11) fmt.Println(f.FarmAnimal())
Output:
Chicken
FileExtension will generate a random file extension
Code:
f := New(11) fmt.Println(f.FileExtension())
Output:
nes
FileMimeType will generate a random mime file type
Code:
f := New(11) fmt.Println(f.FileMimeType())
Output:
application/dsptype
FirefoxUserAgent will generate a random firefox broswer user agent string
Code:
f := New(11) fmt.Println(f.FirefoxUserAgent())
Output:
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_8_3 rv:7.0) Gecko/1908-07-12 Firefox/37.0
FirstName will generate a random first name
Code:
f := New(11) fmt.Println(f.FirstName())
Output:
Markus
FlipACoin will return a random value of Heads or Tails
Code:
f := New(11) fmt.Println(f.FlipACoin())
Output:
Tails
Float32 will generate a random float32 value
Code:
f := New(11) fmt.Println(f.Float32())
Output:
3.1128167e+37
Float32Range will generate a random float32 value between min and max
Code:
f := New(11) fmt.Println(f.Float32Range(0, 9999999))
Output:
914774.6
Float64 will generate a random float64 value
Code:
f := New(11) fmt.Println(f.Float64())
Output:
1.644484108270445e+307
Float64Range will generate a random float64 value between min and max
Code:
f := New(11) fmt.Println(f.Float64Range(0, 9999999))
Output:
914774.5585333086
Fruit will return a random fruit name
Code:
f := New(11) fmt.Println(f.Fruit())
Output:
Date
Gamertag will generate a random video game username
Code:
f := New(11) fmt.Println(f.Gamertag())
Output:
footinterpret63
Gender will generate a random gender string
Code:
f := New(11) fmt.Println(f.Gender())
Output:
female
Generate fake information from given string. Replaceable values should be within {}
Functions Ex: {firstname} - billy Ex: {sentence:3} - Record river mind. Ex: {number:1,10} - 4 Ex: {uuid} - 590c1440-9888-45b0-bd51-a817ee07c3f2
Letters/Numbers Ex: ### - 481 - random numbers Ex: ??? - fda - random letters
For a complete list of runnable functions use FuncsLookup
Code:
f := New(11) fmt.Println(f.Generate("{firstname} {lastname} ssn is {ssn} and lives at {street}")) fmt.Println(f.Generate("{sentence:3}")) fmt.Println(f.Generate("{shuffleints:[1,2,3]}")) fmt.Println(f.Generate("{number:1,50}")) fmt.Println(f.Generate("{shufflestrings:[key:value,int:string,1:2,a:b]}"))
Output:
Markus Moen ssn is 952284213 and lives at 599 New Cliffs stad Arrival tour security. [1 3 2] 34 [a:b key:value int:string 1:2]
HTTPMethod will generate a random http method
Code:
f := New(11) fmt.Println(f.HTTPMethod())
Output:
HEAD
HTTPStatusCode will generate a random status code
Code:
f := New(11) fmt.Println(f.HTTPStatusCode())
Output:
404
HTTPStatusCodeSimple will generate a random simple status code
Code:
f := New(11) fmt.Println(f.HTTPStatusCodeSimple())
Output:
200
HackerAbbreviation will return a random hacker abbreviation
Code:
f := New(11) fmt.Println(f.HackerAbbreviation())
Output:
ADP
HackerAdjective will return a random hacker adjective
Code:
f := New(11) fmt.Println(f.HackerAdjective())
Output:
wireless
HackerNoun will return a random hacker noun
Code:
f := New(11) fmt.Println(f.HackerNoun())
Output:
driver
HackerPhrase will return a random hacker sentence
Code:
f := New(11) fmt.Println(f.HackerPhrase())
Output:
If we calculate the program, we can get to the AI pixel through the redundant XSS matrix!
HackerVerb will return a random hacker verb
Code:
f := New(11) fmt.Println(f.HackerVerb())
Output:
synthesize
HackeringVerb will return a random hacker ingverb
Code:
f := New(11) fmt.Println(f.HackeringVerb())
Output:
connecting
HexColor will generate a random hexadecimal color string
Code:
f := New(11) fmt.Println(f.HexColor())
Output:
#a99fb4
func (f *Faker) HipsterParagraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string
HipsterParagraph will generate a random paragraphGenerator Set Paragraph Count Set Sentence Count Set Word Count Set Paragraph Separator
Code:
f := New(11) fmt.Println(f.HipsterParagraph(3, 5, 12, "\n"))
Output:
Microdosing roof chia echo pickled meditation cold-pressed raw denim fingerstache normcore sriracha pork belly. Wolf try-hard pop-up blog tilde hashtag health butcher waistcoat paleo portland vinegar. Microdosing sartorial blue bottle slow-carb freegan five dollar toast you probably haven't heard of them asymmetrical chia farm-to-table narwhal banjo. Gluten-free blog authentic literally synth vinyl meh ethical health fixie banh mi Yuccie. Try-hard drinking squid seitan cray VHS echo chillwave hammock kombucha food truck sustainable. Pug bushwick hella tote bag cliche direct trade waistcoat yr waistcoat knausgaard pour-over master. Pitchfork jean shorts franzen flexitarian distillery hella meggings austin knausgaard crucifix wolf heirloom. Crucifix food truck you probably haven't heard of them trust fund fixie gentrify pitchfork stumptown mlkshk umami chambray blue bottle. 3 wolf moon swag +1 biodiesel knausgaard semiotics taxidermy meh artisan hoodie +1 blue bottle. Fashion axe forage mixtape Thundercats pork belly whatever 90's beard selfies chambray cred mlkshk. Shabby chic typewriter VHS readymade lo-fi bitters PBR&B gentrify lomo raw denim freegan put a bird on it. Raw denim cliche dreamcatcher pug fixie park trust fund migas fingerstache sriracha +1 mustache. Tilde shoreditch kickstarter franzen dreamcatcher green juice mustache neutra polaroid stumptown organic schlitz. Flexitarian ramps chicharrones kogi lo-fi mustache tilde forage street church-key williamsburg taxidermy. Chia mustache plaid mumblecore squid slow-carb disrupt Thundercats goth shoreditch master direct trade.
HipsterSentence will generate a random sentence
Code:
f := New(11) fmt.Println(f.HipsterSentence(5))
Output:
Microdosing roof chia echo pickled.
HipsterWord will return a single hipster word
Code:
f := New(11) fmt.Println(f.HipsterWord())
Output:
microdosing
Hour will generate a random hour - in military time
Code:
f := New(11) fmt.Println(f.Hour())
Output:
0
IPv4Address will generate a random version 4 ip address
Code:
f := New(11) fmt.Println(f.IPv4Address())
Output:
152.23.53.100
IPv6Address will generate a random version 6 ip address
Code:
f := New(11) fmt.Println(f.IPv6Address())
Output:
8898:ee17:bc35:9064:5866:d019:3b95:7857
Image generates a random rgba image
Code:
f := New(11) fmt.Println(f.Image(1, 1))
Output:
&{[152 23 53 255] 4 (0,0)-(1,1)}
ImageJpeg generates a random rgba jpeg image
Code:
f := New(11) fmt.Println(f.ImageJpeg(1, 1))
Output:
[255 216 255 219 0 132 0 8 6 6 7 6 5 8 7 7 7 9 9 8 10 12 20 13 12 11 11 12 25 18 19 15 20 29 26 31 30 29 26 28 28 32 36 46 39 32 34 44 35 28 28 40 55 41 44 48 49 52 52 52 31 39 57 61 56 50 60 46 51 52 50 1 9 9 9 12 11 12 24 13 13 24 50 33 28 33 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 255 192 0 17 8 0 1 0 1 3 1 34 0 2 17 1 3 17 1 255 196 1 162 0 0 1 5 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 16 0 2 1 3 3 2 4 3 5 5 4 4 0 0 1 125 1 2 3 0 4 17 5 18 33 49 65 6 19 81 97 7 34 113 20 50 129 145 161 8 35 66 177 193 21 82 209 240 36 51 98 114 130 9 10 22 23 24 25 26 37 38 39 40 41 42 52 53 54 55 56 57 58 67 68 69 70 71 72 73 74 83 84 85 86 87 88 89 90 99 100 101 102 103 104 105 106 115 116 117 118 119 120 121 122 131 132 133 134 135 136 137 138 146 147 148 149 150 151 152 153 154 162 163 164 165 166 167 168 169 170 178 179 180 181 182 183 184 185 186 194 195 196 197 198 199 200 201 202 210 211 212 213 214 215 216 217 218 225 226 227 228 229 230 231 232 233 234 241 242 243 244 245 246 247 248 249 250 1 0 3 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 17 0 2 1 2 4 4 3 4 7 5 4 4 0 1 2 119 0 1 2 3 17 4 5 33 49 6 18 65 81 7 97 113 19 34 50 129 8 20 66 145 161 177 193 9 35 51 82 240 21 98 114 209 10 22 36 52 225 37 241 23 24 25 26 38 39 40 41 42 53 54 55 56 57 58 67 68 69 70 71 72 73 74 83 84 85 86 87 88 89 90 99 100 101 102 103 104 105 106 115 116 117 118 119 120 121 122 130 131 132 133 134 135 136 137 138 146 147 148 149 150 151 152 153 154 162 163 164 165 166 167 168 169 170 178 179 180 181 182 183 184 185 186 194 195 196 197 198 199 200 201 202 210 211 212 213 214 215 216 217 218 226 227 228 229 230 231 232 233 234 242 243 244 245 246 247 248 249 250 255 218 0 12 3 1 0 2 17 3 17 0 63 0 224 40 162 138 196 251 115 255 217]
ImagePng generates a random rgba png image
Code:
f := New(11) fmt.Println(f.ImagePng(1, 1))
Output:
[137 80 78 71 13 10 26 10 0 0 0 13 73 72 68 82 0 0 0 1 0 0 0 1 8 2 0 0 0 144 119 83 222 0 0 0 16 73 68 65 84 120 156 98 154 33 110 10 8 0 0 255 255 2 55 0 231 28 250 86 54 0 0 0 0 73 69 78 68 174 66 96 130]
ImageURL will generate a random Image Based Upon Height And Width. https://picsum.photos/
Code:
f := New(11) fmt.Println(f.ImageURL(640, 480))
Output:
https://picsum.photos/640/480
Int16 will generate a random int16 value
Code:
f := New(11) fmt.Println(f.Int16())
Output:
2200
Int32 will generate a random int32 value
Code:
f := New(11) fmt.Println(f.Int32())
Output:
-1072427943
Int64 will generate a random int64 value
Code:
f := New(11) fmt.Println(f.Int64())
Output:
-8379641344161477543
Int8 will generate a random Int8 value
Code:
f := New(11) fmt.Println(f.Int8())
Output:
24
func (f *Faker) JSON(jo *JSONOptions) ([]byte, error)
JSON generates an object or an array of objects in json format
Code:
f := New(11) value, err := f.JSON(&JSONOptions{ Type: "array", Fields: []Field{ {Name: "id", Function: "autoincrement"}, {Name: "first_name", Function: "firstname"}, {Name: "last_name", Function: "lastname"}, {Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}}, }, RowCount: 3, Indent: true, }) if err != nil { fmt.Println(err) } fmt.Println(string(value))
Output:
[ { "id": 1, "first_name": "Markus", "last_name": "Moen", "password": "Dc0VYXjkWABx" }, { "id": 2, "first_name": "Osborne", "last_name": "Hilll", "password": "XPJ9OVNbs5lm" }, { "id": 3, "first_name": "Mertie", "last_name": "Halvorson", "password": "eyl3bhwfV8wA" } ]
Code:
f := New(11) value, err := f.JSON(&JSONOptions{ Type: "object", Fields: []Field{ {Name: "first_name", Function: "firstname"}, {Name: "last_name", Function: "lastname"}, {Name: "address", Function: "address"}, {Name: "password", Function: "password", Params: map[string][]string{"special": {"false"}}}, }, Indent: true, }) if err != nil { fmt.Println(err) } fmt.Println(string(value))
Output:
{ "first_name": "Markus", "last_name": "Moen", "address": { "address": "4599 Dale ton, Lake Carroll, Mississippi 90635", "street": "4599 Dale ton", "city": "Lake Carroll", "state": "Mississippi", "zip": "90635", "country": "Saint Pierre and Miquelon", "latitude": 22.008873, "longitude": 158.531956 }, "password": "YjJbXclnVN0H" }
Job will generate a struct with random job information
Code:
f := New(11) jobInfo := f.Job() fmt.Println(jobInfo.Company) fmt.Println(jobInfo.Title) fmt.Println(jobInfo.Descriptor) fmt.Println(jobInfo.Level)
Output:
ClearHealthCosts Agent Future Tactics
JobDescriptor will generate a random job descriptor string
Code:
f := New(11) fmt.Println(f.JobDescriptor())
Output:
Central
JobLevel will generate a random job level string
Code:
f := New(11) fmt.Println(f.JobLevel())
Output:
Assurance
JobTitle will generate a random job title string
Code:
f := New(11) fmt.Println(f.JobTitle())
Output:
Director
Language will return a random language
Code:
f := New(11) fmt.Println(f.Language())
Output:
Kazakh
LanguageAbbreviation will return a random language abbreviation
Code:
f := New(11) fmt.Println(f.LanguageAbbreviation())
Output:
kk
LastName will generate a random last name
Code:
f := New(11) fmt.Println(f.LastName())
Output:
Daniel
Latitude will generate a random latitude float64
Code:
f := New(11) fmt.Println(f.Latitude())
Output:
-73.534057
LatitudeInRange will generate a random latitude within the input range
Code:
f := New(11) lat, _ := f.LatitudeInRange(21, 42) fmt.Println(lat)
Output:
22.921026
Letter will generate a single random lower case ASCII letter
Code:
f := New(11) fmt.Println(f.Letter())
Output:
g
LetterN will generate a random ASCII string with length N
Code:
f := New(11) fmt.Println(f.LetterN(10))
Output:
gbRMaRxHki
Lexify will replace ? will random generated letters
Code:
f := New(11) fmt.Println(f.Lexify("?????"))
Output:
gbRMa
LogLevel will generate a random log level See data/LogLevels for list of available levels
Code:
f := New(11)
fmt.Println(f.LogLevel("")) // This will also use general
fmt.Println(f.LogLevel("syslog"))
fmt.Println(f.LogLevel("apache"))
Output:
error debug trace1-8
Longitude will generate a random longitude float64
Code:
f := New(11) fmt.Println(f.Longitude())
Output:
-147.068113
LongitudeInRange will generate a random longitude within the input range
Code:
f := New(11) long, _ := f.LongitudeInRange(-10, 10) fmt.Println(long)
Output:
-8.170451
func (f *Faker) LoremIpsumParagraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string
LoremIpsumParagraph will generate a random paragraphGenerator
Code:
f := New(11) fmt.Println(f.LoremIpsumParagraph(3, 5, 12, "\n"))
Output:
Quia quae repellat consequatur quidem nisi quo qui voluptatum accusantium quisquam amet. Quas et ut non dolorem ipsam aut enim assumenda mollitia harum ut. Dicta similique veniam nulla voluptas at excepturi non ad maxime at non. Eaque hic repellat praesentium voluptatem qui consequuntur dolor iusto autem velit aut. Fugit tempore exercitationem harum consequatur voluptatum modi minima aut eaque et et. Aut ea voluptatem dignissimos expedita odit tempore quod aut beatae ipsam iste. Minus voluptatibus dolorem maiores eius sed nihil vel enim odio voluptatem accusamus. Natus quibusdam temporibus tenetur cumque sint necessitatibus dolorem ex ducimus iusto ex. Voluptatem neque dicta explicabo officiis et ducimus sit ut ut praesentium pariatur. Illum molestias nisi at dolore ut voluptatem accusantium et fugiat et ut. Explicabo incidunt reprehenderit non quia dignissimos recusandae vitae soluta quia et quia. Aut veniam voluptas consequatur placeat sapiente non eveniet voluptatibus magni velit eum. Nobis vel repellendus sed est qui autem laudantium quidem quam ullam consequatur. Aut iusto ut commodi similique quae voluptatem atque qui fugiat eum aut. Quis distinctio consequatur voluptatem vel aliquid aut laborum facere officiis iure tempora.
LoremIpsumSentence will generate a random sentence
Code:
f := New(11) fmt.Println(f.LoremIpsumSentence(5))
Output:
Quia quae repellat consequatur quidem.
LoremIpsumWord will generate a random word
Code:
f := New(11) fmt.Println(f.LoremIpsumWord())
Output:
quia
Lunch will return a random lunch name
Code:
f := New(11) fmt.Println(f.Lunch())
Output:
No bake hersheys bar pie
MacAddress will generate a random mac address
Code:
f := New(11) fmt.Println(f.MacAddress())
Output:
e1:74:cb:01:77:91
Map will generate a random set of map data
Code:
f := New(11) fmt.Println(f.Map())
Output:
map[approach:map[mind:[arrival should resolve outcome hurt]] arrive:Coordinator consult:respond context:9285735 water:5081652]
Minute will generate a random minute
Code:
f := New(11) fmt.Println(f.Minute())
Output:
0
Month will generate a random month string
Code:
f := New(11) fmt.Println(f.Month())
Output:
January
Name will generate a random First and Last Name
Code:
f := New(11) fmt.Println(f.Name())
Output:
Markus Moen
NamePrefix will generate a random name prefix
Code:
f := New(11) fmt.Println(f.NamePrefix())
Output:
Mr.
NameSuffix will generate a random name suffix
Code:
f := New(11) fmt.Println(f.NameSuffix())
Output:
Jr.
NanoSecond will generate a random nano second
Code:
f := New(11) fmt.Println(f.NanoSecond())
Output:
196446360
Noun will generate a random noun
Code:
f := New(11) fmt.Println(f.Noun())
Output:
foot
Number will generate a random number between given min And max
Code:
f := New(11) fmt.Println(f.Number(50, 23456))
Output:
14866
Numerify will replace # with random numerical values
Code:
f := New(11) fmt.Println(f.Numerify("###-###-####"))
Output:
613-645-9948
OperaUserAgent will generate a random opera browser user agent string
Code:
f := New(11) fmt.Println(f.OperaUserAgent())
Output:
Opera/8.39 (Macintosh; U; PPC Mac OS X 10_8_7; en-US) Presto/2.9.335 Version/10.00
func (f *Faker) Paragraph(paragraphCount int, sentenceCount int, wordCount int, separator string) string
Paragraph will generate a random paragraphGenerator
Code:
f := New(11) fmt.Println(f.Paragraph(3, 5, 12, "\n"))
Output:
Interpret context record river mind press self should compare property outcome divide. Combine approach sustain consult discover explanation direct address church husband seek army. Begin own act welfare replace press suspect stay link place manchester specialist. Arrive price satisfy sign force application hair train provide basis right pay. Close mark teacher strengthen information attempt head touch aim iron tv take. Handle wait begin look speech trust cancer visit capacity disease chancellor clean. Race aim function gain couple push faith enjoy admit ring attitude develop. Edge game prevent cast mill favour father star live search aim guess. West heart item adopt compete equipment miss output report communicate model cabinet. Seek worker variety step argue air improve give succeed relief artist suffer. Hide finish insist knowledge thatcher make research chance structure proportion husband implement. Town crown restaurant cost material compete lady climb football region discussion order. Place lee market ice like display mind stress compete weather station raise. Democracy college major recall struggle use cut intention accept period generation strike. Benefit defend recommend conclude justify result depend succeed address owner fill interpret.
func (f *Faker) Password(lower bool, upper bool, numeric bool, special bool, space bool, num int) string
Password will generate a random password. Minimum number length of 5 if less than.
Code:
f := New(11) fmt.Println(f.Password(true, false, false, false, false, 32)) fmt.Println(f.Password(false, true, false, false, false, 32)) fmt.Println(f.Password(false, false, true, false, false, 32)) fmt.Println(f.Password(false, false, false, true, false, 32)) fmt.Println(f.Password(true, true, true, true, true, 32)) fmt.Println(f.Password(true, true, true, true, true, 4))
Output:
vodnqxzsuptgehrzylximvylxzoywexw ZSRQWJFJWCSTVGXKYKWMLIAFGFELFJRG 61718615932495608398906260648432 @$,@#:,(,).{?:%?)>*..<=};#$(:{== CkF{wwb:?Kb},w?vdz{Zox C&>Prt99: j ;9X
func (f *Faker) Person() *PersonInfo
Person will generate a struct with person information
Code:
f := New(11) person := f.Person() job := person.Job address := person.Address contact := person.Contact creditCard := person.CreditCard fmt.Println(person.FirstName) fmt.Println(person.LastName) fmt.Println(person.Gender) fmt.Println(person.SSN) fmt.Println(person.Image) fmt.Println(job.Company) fmt.Println(job.Title) fmt.Println(job.Descriptor) fmt.Println(job.Level) fmt.Println(address.Address) fmt.Println(address.Street) fmt.Println(address.City) fmt.Println(address.State) fmt.Println(address.Zip) fmt.Println(address.Country) fmt.Println(address.Latitude) fmt.Println(address.Longitude) fmt.Println(contact.Phone) fmt.Println(contact.Email) fmt.Println(creditCard.Type) fmt.Println(creditCard.Number) fmt.Println(creditCard.Exp) fmt.Println(creditCard.Cvv)
Output:
Markus Moen male 420776036 https://picsum.photos/300/300/people Morgan Stanley Associate Human Usability 99536 North Stream ville, Rossieview, Hawaii 42591 99536 North Stream ville Rossieview Hawaii 42591 Burkina Faso -6.662595 23.921575 3023202027 lamarkoelpin@heaney.biz Maestro 39800889982276 05/30 932
PetName will return a random fun pet name
Code:
f := New(11) fmt.Println(f.PetName())
Output:
Ozzy Pawsborne
Phone will generate a random phone number string
Code:
f := New(11) fmt.Println(f.Phone())
Output:
6136459948
PhoneFormatted will generate a random phone number string
Code:
f := New(11) fmt.Println(f.PhoneFormatted())
Output:
136-459-9489
Phrase will return a random dictionary phrase
Code:
f := New(11) fmt.Println(f.Phrase())
Output:
shut the front door
Preposition will generate a random preposition
Code:
f := New(11) fmt.Println(f.Preposition())
Output:
down
Price will take in a min and max value and return a formatted price
Code:
f := New(11) fmt.Printf("%.2f", f.Price(0.8618, 1000))
Output:
92.26
ProgrammingLanguage will return a random programming language
Code:
f := New(464) fmt.Println(f.ProgrammingLanguage())
Output:
Go
ProgrammingLanguageBest will return a random programming language
Code:
f := New(11) fmt.Println(f.ProgrammingLanguageBest())
Output:
Go
Question will return a random question
Code:
f := New(11) fmt.Println(f.Question())
Output:
Roof chia echo?
Quote will return a random quote from a random person
Code:
f := New(11) fmt.Println(f.Quote())
Output:
"Roof chia echo." - Lura Lockman
RGBColor will generate a random int slice color
Code:
f := New(11) fmt.Println(f.RGBColor())
Output:
[152 23 53]
RandomInt will take in a slice of int and return a randomly selected value
Code:
f := New(11) ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657} fmt.Println(f.RandomInt(ints))
Output:
52
RandomString will take in a slice of string and return a randomly selected value
Code:
f := New(11) fmt.Println(f.RandomString([]string{"hello", "world"}))
Output:
hello
RandomUint will take in a slice of uint and return a randomly selected value
Code:
f := New(11) ints := []uint{52, 854, 941, 74125, 8413, 777, 89416, 841657} fmt.Println(f.RandomUint(ints))
Output:
52
Regex will generate a string based upon a RE2 syntax
Code:
f := New(11) fmt.Println(f.Regex("[abcdef]{5}")) fmt.Println(f.Regex("[[:upper:]]{5}")) fmt.Println(f.Regex("(hello|world|whats|up)")) fmt.Println(f.Regex(`^[a-z]{5,10}@[a-z]{5,10}\.(com|net|org)$`))
Output:
affec RXHKI up ptapwy@dnsmkgtl.com
SSN will generate a random Social Security Number
Code:
f := New(11) fmt.Println(f.SSN())
Output:
296446360
SafariUserAgent will generate a random safari browser user agent string
Code:
f := New(11) fmt.Println(f.SafariUserAgent())
Output:
Mozilla/5.0 (iPad; CPU OS 8_3_2 like Mac OS X; en-US) AppleWebKit/531.15.6 (KHTML, like Gecko) Version/4.0.5 Mobile/8B120 Safari/6531.15.6
SafeColor will generate a random safe color string
Code:
f := New(11) fmt.Println(f.SafeColor())
Output:
black
Second will generate a random second
Code:
f := New(11) fmt.Println(f.Second())
Output:
0
Sentence will generate a random sentence
Code:
f := New(11) fmt.Println(f.Sentence(5))
Output:
Interpret context record river mind.
ShuffleAnySlice takes in a slice and outputs it in a random order
Code:
f := New(11) strings := []string{"happy", "times", "for", "everyone", "have", "a", "good", "day"} f.ShuffleAnySlice(strings) fmt.Println(strings) ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657} f.ShuffleAnySlice(ints) fmt.Println(ints)
Output:
[good everyone have for times a day happy] [777 74125 941 854 89416 52 8413 841657]
ShuffleInts will randomize a slice of ints
Code:
f := New(11) ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657} f.ShuffleInts(ints) fmt.Println(ints)
Output:
[74125 777 941 89416 8413 854 52 841657]
ShuffleStrings will randomize a slice of strings
Code:
f := New(11) strings := []string{"happy", "times", "for", "everyone", "have", "a", "good", "day"} f.ShuffleStrings(strings) fmt.Println(strings)
Output:
[good everyone have for times a day happy]
Snack will return a random snack name
Code:
f := New(11) fmt.Println(f.Snack())
Output:
Hoisin marinated wing pieces
State will generate a random state string
Code:
f := New(11) fmt.Println(f.State())
Output:
Hawaii
StateAbr will generate a random abbreviated state string
Code:
f := New(11) fmt.Println(f.StateAbr())
Output:
OR
Street will generate a random address street string
Code:
f := New(11) fmt.Println(f.Street())
Output:
364 East Rapids borough
StreetName will generate a random address street name string
Code:
f := New(11) fmt.Println(f.StreetName())
Output:
View
StreetNumber will generate a random address street number string
Code:
f := New(11) fmt.Println(f.StreetNumber())
Output:
13645
StreetPrefix will generate a random address street prefix string
Code:
f := New(11) fmt.Println(f.StreetPrefix())
Output:
Lake
StreetSuffix will generate a random address street suffix string
Code:
f := New(11) fmt.Println(f.StreetSuffix())
Output:
land
Struct fills in exported elements of a struct with random data based on the value of `fake` tag of exported elements. Use `fake:"skip"` to explicitly skip an element. All built-in types are supported, with templating support for string types.
Teams takes in an array of people and team names and randomly places the people into teams as evenly as possible
Code:
f := New(11) fmt.Println(f.Teams( []string{"Billy", "Sharon", "Jeff", "Connor", "Steve", "Justin", "Fabian", "Robert"}, []string{"Team 1", "Team 2", "Team 3"}, ))
Output:
map[Team 1:[Fabian Connor Steve] Team 2:[Jeff Sharon Justin] Team 3:[Robert Billy]]
TimeZone will select a random timezone string
Code:
f := New(11) fmt.Println(f.TimeZone())
Output:
Kaliningrad Standard Time
TimeZoneAbv will select a random timezone abbreviation string
Code:
f := New(11) fmt.Println(f.TimeZoneAbv())
Output:
KST
TimeZoneFull will select a random full timezone string
Code:
f := New(11) fmt.Println(f.TimeZoneFull())
Output:
(UTC+03:00) Kaliningrad, Minsk
TimeZoneOffset will select a random timezone offset
Code:
f := New(11) fmt.Println(f.TimeZoneOffset())
Output:
3
TimeZoneRegion will select a random region style timezone string, e.g. "America/Chicago"
Code:
f := New(11) fmt.Println(f.TimeZoneRegion())
Output:
America/Vancouver
URL will generate a random url string
Code:
f := New(11) fmt.Println(f.URL())
Output:
http://www.principalproductize.biz/target
UUID (version 4) will generate a random unique identifier based upon random numbers Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Code:
f := New(11) fmt.Println(f.UUID())
Output:
590c1440-9888-45b0-bd51-a817ee07c3f2
Uint16 will generate a random uint16 value
Code:
f := New(11) fmt.Println(f.Uint16())
Output:
34968
Uint32 will generate a random uint32 value
Code:
f := New(11) fmt.Println(f.Uint32())
Output:
1075055705
Uint64 will generate a random uint64 value
Code:
f := New(11) fmt.Println(f.Uint64())
Output:
843730692693298265
Uint8 will generate a random uint8 value
Code:
f := New(11) fmt.Println(f.Uint8())
Output:
152
UserAgent will generate a random broswer user agent
Code:
f := New(11) fmt.Println(f.UserAgent())
Output:
Mozilla/5.0 (Windows NT 5.0) AppleWebKit/5362 (KHTML, like Gecko) Chrome/37.0.834.0 Mobile Safari/5362
Username will generate a random username based upon picking a random lastname and random numbers at the end
Code:
f := New(11) fmt.Println(f.Username())
Output:
Daniel1364
Vegetable will return a random vegetable name
Code:
f := New(11) fmt.Println(f.Vegetable())
Output:
Amaranth Leaves
Verb will generate a random verb
Code:
f := New(11) fmt.Println(f.Verb())
Output:
release
WeekDay will generate a random weekday string (Monday-Sunday)
Code:
f := New(11) fmt.Println(f.WeekDay())
Output:
Friday
Word will generate a random word
Code:
f := New(11) fmt.Println(f.Word())
Output:
interpret
func (f *Faker) XML(xo *XMLOptions) ([]byte, error)
XML generates an object or an array of objects in json format
Year will generate a random year between 1900 - current year
Code:
f := New(11) fmt.Println(f.Year())
Output:
1908
Zip will generate a random Zip code string
Code:
f := New(11) fmt.Println(f.Zip())
Output:
13645
type Field struct { Name string `json:"name"` Function string `json:"function"` Params MapParams `json:"params"` }
Field is used for defining what name and function you to generate for file outuputs
type Info struct { Display string `json:"display"` Category string `json:"category"` Description string `json:"description"` Example string `json:"example"` Output string `json:"output"` Data map[string]string `json:"-"` Params []Param `json:"params"` Generate func(r *rand.Rand, m *MapParams, info *Info) (interface{}, error) `json:"-"` }
Info structures fields to better break down what each one generates
GetFuncLookup will lookup
GetBool will retrieve boolean field from data
GetField will retrieve field from data
GetFloat32 will retrieve int field from data
GetFloat64 will retrieve int field from data
GetInt will retrieve int field from data
GetIntArray will retrieve []int field from data
GetString will retrieve string field from data
GetStringArray will retrieve []string field from data
GetUint will retrieve uint field from data
type JSONOptions struct { Type string `json:"type" xml:"type"` // array or object RowCount int `json:"row_count" xml:"row_count"` Fields []Field `json:"fields" xml:"fields"` Indent bool `json:"indent" xml:"indent"` }
JSONOptions defines values needed for json generation
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"` }
JobInfo is a struct of job information
Job will generate a struct with random job information
Code:
Seed(11) jobInfo := Job() fmt.Println(jobInfo.Company) fmt.Println(jobInfo.Title) fmt.Println(jobInfo.Descriptor) fmt.Println(jobInfo.Level)
Output:
ClearHealthCosts Agent Future Tactics
MapParams is the values to pass into a lookup generate
NewMapParams will create a new MapParams
Add will take in a field and value and add it to the map params type
type Param struct { Field string `json:"field"` Display string `json:"display"` Type string `json:"type"` Optional bool `json:"optional"` Default string `json:"default"` Options []string `json:"options"` Description string `json:"description"` }
Param is a breakdown of param requirements and type definition
type PersonInfo struct { FirstName string `json:"first_name" xml:"first_name"` LastName string `json:"last_name" xml:"last_name"` Gender string `json:"gender" xml:"gender"` SSN string `json:"ssn" xml:"ssn"` Image string `json:"image" xml:"image"` Job *JobInfo `json:"job" xml:"job"` Address *AddressInfo `json:"address" xml:"address"` Contact *ContactInfo `json:"contact" xml:"contact"` CreditCard *CreditCardInfo `json:"credit_card" xml:"credit_card"` }
PersonInfo is a struct of person information
func Person() *PersonInfo
Person will generate a struct with person information
Code:
Seed(11) person := Person() job := person.Job address := person.Address contact := person.Contact creditCard := person.CreditCard fmt.Println(person.FirstName) fmt.Println(person.LastName) fmt.Println(person.Gender) fmt.Println(person.SSN) fmt.Println(person.Image) fmt.Println(job.Company) fmt.Println(job.Title) fmt.Println(job.Descriptor) fmt.Println(job.Level) fmt.Println(address.Address) fmt.Println(address.Street) fmt.Println(address.City) fmt.Println(address.State) fmt.Println(address.Zip) fmt.Println(address.Country) fmt.Println(address.Latitude) fmt.Println(address.Longitude) fmt.Println(contact.Phone) fmt.Println(contact.Email) fmt.Println(creditCard.Type) fmt.Println(creditCard.Number) fmt.Println(creditCard.Exp) fmt.Println(creditCard.Cvv)
Output:
Markus Moen male 420776036 https://picsum.photos/300/300/people Morgan Stanley Associate Human Usability 99536 North Stream ville, Rossieview, Hawaii 42591 99536 North Stream ville Rossieview Hawaii 42591 Burkina Faso -6.662595 23.921575 3023202027 lamarkoelpin@heaney.biz Maestro 39800889982276 05/30 932
type XMLOptions struct { Type string `json:"type" xml:"type"` // single or multiple RootElement string `json:"root_element" xml:"root_element"` RecordElement string `json:"record_element" xml:"record_element"` RowCount int `json:"row_count" xml:"row_count"` Fields []Field `json:"fields" xml:"fields"` Indent bool `json:"indent" xml:"indent"` }
XMLOptions defines values needed for json generation
Path | Synopsis |
---|---|
data |
Package gofakeit imports 23 packages (graph) and is imported by 11 packages. Updated 2021-01-26. Refresh now. Tools for package owners.