GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - syscrusher/fake: Fake data generator for Go (Golang)

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

97 Commits
97 Commits

Folders and files

NameName
Last commit message
Last commit date
data
data
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
addresses.go
addresses.go
 
 
addresses_test.go
addresses_test.go
 
 
credit_cards.go
credit_cards.go
 
 
credit_cards_test.go
credit_cards_test.go
 
 
currencies.go
currencies.go
 
 
data.go
data.go
 
 
dates.go
dates.go
 
 
dates_test.go
dates_test.go
 
 
doc.go
doc.go
 
 
fake.go
fake.go
 
 
fake_test.go
fake_test.go
 
 
general.go
general.go
 
 
general_test.go
general_test.go
 
 
geo.go
geo.go
 
 
geo_test.go
geo_test.go
 
 
internet.go
internet.go
 
 
internet_test.go
internet_test.go
 
 
jobs.go
jobs.go
 
 
lorem_ipsum.go
lorem_ipsum.go
 
 
lorem_ipsum_test.go
lorem_ipsum_test.go
 
 
names.go
names.go
 
 
personal.go
personal.go
 
 
products.go
products.go
 
 
simple_test.go
simple_test.go
 
 

Repository files navigation

Fake

Build Status GoDoc License Go Report Card

Fake is a fake data generator for Go (Golang), heavily inspired by the forgery and ffaker Ruby gems. This particular branch is a fork from icrowley with improvements merged from the community.

About

Most data and methods are ported from forgery/ffaker Ruby gems. For the list of available methods, please look at GoDoc.

Currently, English and Russian are available. English is the default. If the selected language does not implement the required data, then English will be returned as a fallback. This may be disabled by calling EnFallback(false).

Fake stores the raw data in line-delimited files under data/, which is subdivided by language. By default, fake uses a gzip'd representation of the filesystem generated by mjibson/esc. Embedding the data removes external file dependencies during runtime, and compression gives a small space gain. Decompressed files are cached after first access.

If the sample data is changed or new data is added, data.go must be regenerated. If you are using Go >=1.4, then a simple go generate will handle it. Otherwise, you must get mjibson/esc and run esc -o data.go -pkg fake data.

Fake can load the files directly from the filesystem by calling UseExternalData(true).

Examples

Basic data:

name := fake.FirstName()
fullname := fake.FullName()
product := fake.Product()

Select non-English language:

err := fake.SetLang("ru")
if err != nil {
  panic(err)
}
password := fake.SimplePassword()

Remove English fallback:

err := fake.SetLang("ru")
if err != nil {
  panic(err)
}
fake.EnFallback(false)
password := fake.Paragraph() // returns a blank string because Paragraph() is not implemented in Russian

Use external data:

fake.UseExternalData(true)
password := fake.Paragraph()

Credit

The common English wordlist located in data/en/words is from Wiktionary, licensed under the Creative Commons Attribution-ShareAlike License

About

Fake data generator for Go (Golang)

Resources

Readme
MIT license
Activity

Stars

9 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.