Help us shape the future of Go! Take the 2026 Go Developer Survey

fakedata

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2017 License: MIT

README

fakedata

CLI utility that generates data in various formats.

Overview

fakedata is a small utility that generates data from the command line:

Quick start

$ fakedata email country
cemshid@example.com Afghanistan
LucasPerdidao@example.me Turkey
arthurholcombe1@test.us Saint Helena
iamgarth@example.us Montenegro
joelcipriano@test.name Croatia
keryilmaz@test.name Vietnam
plbabin@test.org Lithuania
bermonpainter@test.us Haiti
opnsrce@example.name Malaysia
ankitind@test.info Virgin Islands, British

Limit the amout of generated rows:

$ fakedata country.code --limit 5
SH
CF
GQ
PE
FO

Choose a different output format:

$ fakedata product.category product.name --format=csv
Shoes,Rankfix
Automotive,Namis
Movies,Matquadfax
Tools,Damlight
Computers,Silverlux
Industrial,Matquadfax
Home,Sil-Home
Health,Toughwarm
Shoes,Freetop
Tools,Domnix

Generators

fakedata provides a number of generators:

$ fakedata --generators
color             one word color
country           Full country name
country.code      2-digit country code
date              date
domain            domain
domain.tld        example|test
# ...
# It's a long list :)

Some generators allow you to pass in a range so you can scope their generation to a subset of values:

$ fakedata int,1..100 # will generate only integers between 1 and 100
$ fakedata int,50.. # specifying only min number works too
$ fakedata int,50 # also works

The enum generator allows you to specify a set of values. It comes handy when you need random data from a small subset of values:

$ fakedata enum --limit 5
foo
baz
foo
foo
baz
$ fakedata enum,bug..feature..question..duplicate --limit 5
question
duplicate
duplicate
bug
feature

Formatters

SQL formatter

fakedata can generate insert statements. By default, it uses the name of the generators as column names:

$ fakedata email domain --format=sql --limit 1
INSERT INTO TABLE (email,domain) values ('yigitpinarbasi@example.org','example.me');

You can specify the name of the column using a field with the following format column_name=generator. For example:

$ fakedata login=email referral=domain --format=sql --limit 1
INSERT INTO TABLE (login,referral) values ('calebogden@example.com','test.me');

How to install

Homebrew

fakedata can be installed through Homebrew:

$ brew tap lucapette/tap
$ brew install fakedata

Standalone

fakedata can be installed as an executable. Download the latest compiled binaries and put it anywhere in your executable path.

Source

Please refer to our contributing guidelines to build and install fakedata from the source.

How to contribute

Please refer to our contributing guidelines.

Code of Conduct

You are expected to follow our code of conduct when interacting with the project via issues, pull requests or in any other form. Many thanks to the awesome contributor covenant initiative!

License

MIT License Copyright (c) [2017] Luca Pette

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL