Random fake data generator written in go
Clone or download
Latest commit 001277c Oct 11, 2018
Permalink
Failed to load latest commit information.
data datetime - added timezone Sep 4, 2018
.travis.yml travis - lets see if we can get go version 1 to successfully test Aug 20, 2018
BENCHMARKS.md person - fixed ssn Aug 8, 2018
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Jul 28, 2017
CONTRIBUTING.md Create CONTRIBUTING.md Jul 28, 2017
LICENSE.txt added license Apr 27, 2015
README.md readme - minor update Jun 6, 2018
TODO.txt todo - minor text update Aug 20, 2018
address.go numbers - added float32 and float64 ranges Oct 11, 2018
address_test.go address - addresss output update Aug 6, 2018
beer.go numbers - added float32 and float64 ranges Oct 11, 2018
beer_test.go beer - i added BEEEER!!! Jun 2, 2017
bool.go golint - rand golint and address any issues. Jun 29, 2015
bool_test.go added bool Jun 16, 2015
color.go color - optimize hexcolor Oct 4, 2017
color_test.go color - optimize hexcolor Oct 4, 2017
company.go golint - rand golint and address any issues. Jun 29, 2015
company_test.go testing - coverage update Apr 29, 2017
contact.go contact - added phone and phoneformatted Apr 17, 2018
contact_test.go contact - added phone and phoneformatted Apr 17, 2018
currency.go numbers - added float32 and float64 ranges Oct 11, 2018
currency_test.go price - added price Apr 23, 2018
datetime.go datetime - added timezone Sep 4, 2018
datetime_test.go datetime - added timezone Sep 4, 2018
doc.go docs - minor update Jun 13, 2017
faker.go updated testing, commenting and examples. Apr 26, 2015
faker_test.go password - updated to make password implement at least 1 of each type… Aug 9, 2018
file.go golint - rand golint and address any issues. Jun 29, 2015
file_test.go file - updated mime types and added extensions. Apr 27, 2015
generate.go misc - fixed misspelled name Mar 21, 2018
generate_test.go data - cleaned up and separated data information Jun 1, 2017
hacker.go hacker - added hacker info Jun 2, 2017
hacker_test.go hacker - added hacker info Jun 2, 2017
hipster.go hipster - added hipster words Jun 2, 2017
hipster_test.go hipster - added hipster words Jun 2, 2017
image.go golint - rand golint and address any issues. Jun 29, 2015
image_test.go golint - rand golint and address any issues. Jun 29, 2015
internet.go password work in progress Aug 8, 2018
internet_test.go password work in progress Aug 8, 2018
job.go golint - rand golint and address any issues. Jun 29, 2015
job_test.go Job - added job info struct. Jun 16, 2015
log_level.go made log level adjustments Apr 8, 2018
log_level_test.go made log level adjustments Apr 8, 2018
logo.png added logo Mar 21, 2018
misc.go numbers - added float32 and float64 ranges Oct 11, 2018
misc_test.go numbers - added float32 and float64 ranges Oct 11, 2018
name.go data - cleaned up and separated data information Jun 1, 2017
name_test.go golint - rand golint and address any issues. Jun 29, 2015
number.go numbers - added float32 and float64 ranges Oct 11, 2018
number_test.go numbers - added float32 and float64 ranges Oct 11, 2018
password.go password - updated to make password implement at least 1 of each type… Aug 9, 2018
password_test.go password - 100% code coverage Aug 9, 2018
payment.go payment - added credit card that is luhn valid Sep 5, 2018
payment_test.go payment - added credit card that is luhn valid Sep 5, 2018
person.go person - fixed ssn Aug 8, 2018
person_test.go payment - exp date cards will always be in the future Aug 20, 2018
status_code.go Supports random HTTP status code Oct 25, 2017
status_code_test.go Supports random HTTP status code Oct 25, 2017
string.go rand - usage update May 6, 2017
string_test.go rand - usage update May 6, 2017
struct.go mispelling Mar 21, 2018
struct_test.go struct - cleaned up code. made it 100% code coveraged. and removed de… Mar 21, 2018
unique.go unique - because value is set from core langauge no need to look for … Mar 21, 2018
unique_test.go uuid - swapped UniqueID with UUID and used version 4 Nov 9, 2017
user_agent.go data - cleaned up and separated data information Jun 1, 2017
user_agent_test.go tests: change example test outputs Jan 4, 2018
words.go hipster - added hipster words Jun 2, 2017
words_test.go updated testing, commenting and examples. Apr 26, 2015

README.md

alt text

gofakeit Go Report Card Build Status codecov.io GoDoc license

Random data generator written in go

Buy Me A Coffee

Features

  • Every function has an example and a benchmark, see benchmarks
  • Zero dependencies
  • Randomizes user defined structs
  • Numerous functions for regular use
  • Extensible

80+ Functions!!!

If there is something that is generic enough missing from this package add an issue and let me know what you need. Most of the time i'll add it!

Documentation

GoDoc

Example

import "github.com/brianvoe/gofakeit"

gofakeit.Name() // Markus Moen
gofakeit.Email() // alaynawuckert@kozey.biz
gofakeit.Phone() // (570)245-7485
gofakeit.BS() // front-end
gofakeit.BeerName() // Duvel
gofakeit.Color() // MediumOrchid
gofakeit.Company() // Moen, Pagac and Wuckert
gofakeit.CreditCardNumber() // 4287271570245748
gofakeit.HackerPhrase() // Connecting the array won't do anything, we need to generate the haptic COM driver!
gofakeit.JobTitle() // Director
gofakeit.Password(true, true, true, true, true, 32) // WV10MzLxq2DX79w1omH97_0ga59j8!kj
gofakeit.CurrencyShort() // USD
// 80+ more!!!

// Create structs with random injected data
type Foo struct {
	Bar     string
	Baz     string
	Int     int
	Pointer *int
	Skip    *string `fake:"skip"` // Set to "skip" to not generate data for
}
var f Foo
gofakeit.Struct(&f)
fmt.Printf("f.Bar:%s\n", f.Bar) // f.Bar:hrukpttuezptneuvunh
fmt.Printf("f.Baz:%s\n", f.Baz) // f.Baz:uksqvgzadxlgghejkmv
fmt.Printf("f.Int:%d\n", f.Int) // f.Int:-7825289004089916589
fmt.Printf("f.Pointer:%d\n", *f.Pointer) // f.Pointer:-343806609094473732
fmt.Printf("f.Skip:%v\n", f.Skip) // f.Skip:<nil>