gofaker

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 9 Imported by: 0

README

License

faker-cli

Simple command line client for the wonderful faker pacakge allowing one to quickly mock random user data

Build/Install

You can build and install the official repository with Go:

go get github.com/mkatychev/faker-cli/cmd/gofaker

Usage

Usage:
	gofaker address
	gofaker adult [--min=<years>] [--max=<years>] (age|dob [-Y|-M|-D|--fmt=<fmt>])
	gofaker city
	gofaker country [--short]
	gofaker email
	gofaker (guid|uuid)
	gofaker name [first|last]
	gofaker now [--fmt=<fmt>]
	gofaker password [<min> <max>]
	gofaker phone [--short]
	gofaker (postal-code|zip) [--short] [--state=<state>]
	gofaker sex [--short] [--lower]
	gofaker state [--short] [-n <val,>]
	gofaker street
	gofaker street2
	gofaker ssn [--short] [--now]

Options:
  -h --help                    Show this screen.
  --version                    Show version.
  --short                      Return shortform of relevant data.
  --min=<years>                Lower age limit for fake adult generation [default: 18].
  --max=<years>                Upper age limit for fake adult generation [default: 69].
  --fmt=<fmt>                  Timestamp formatter, uses the magical reference date of:
                               "Mon Jan 2 15:04:05 MST 2006"/"2006-01-02" [default: 2006-01-02].
  --not <val,>, -n <val,>      Blacklist specific string values, comma separated.
  --now                        Creates an SSN from the first 9 characters of the current timestamp.

Documentation

Index

Constants

View Source
const SSNRegex = `[134578]\d\d[1-9]\d[1-9]\d\d\d`

SSNRegex is used to implement pseudorandom RE generator that passes perl re while using re2 engine valid perl regex (that is invalid re2 regex): regex = "^(?!666|000|9\\d{2})\\d{3}-(?!00)\\d{2}-(?!0{4})\\d{4}$"; simple approach: [^2069]xx [^0]x [^0]xxx https://en.wikipedia.org/wiki/Social_Security_number#Valid_SSNs

Variables

View Source
var DateFormat = "2006-01-02"

DateFormat is used to format time outputs

View Source
var Lower bool

Lower returns the lowercased form of relevant data.

View Source
var Not map[string]bool

Not is used to blacklist specific string values

View Source
var Short bool

Short returns shortform of relevant data.

Functions

func Exclude

func Exclude(list []string, exclusion map[string]bool) []string

Exclude produces a laundered list of the excluded values

func HandleAddress

func HandleAddress(opts map[string]interface{}) string

HandleAddress handles `gofaker (city|state|zip-code|country)`

func HandleAdult

func HandleAdult(opts map[string]interface{}) string

HandleAdult handles `gofaker adult []` arguments TODO Pass in country codes for legal adult age current assumption is an adult age is 18 years or older

func HandleEmail

func HandleEmail(opts map[string]interface{}) string

HandleEmail handles `gofaker email`

func HandleGUID added in v0.5.0

func HandleGUID(opts map[string]interface{}) string

HandleGUID handles `gofaker (guid|uuid)`

func HandleName

func HandleName(opts map[string]interface{}) string

HandleName handles the boolean map if `gofaker name` is called

func HandleNow added in v0.4.0

func HandleNow(opts map[string]interface{}) string

HandleNow handles `gofaker now`

func HandlePassword

func HandlePassword(opts map[string]interface{}) string

HandlePassword handles `gofaker password` generation, allows a max and min length default is 8-24

func HandlePhone

func HandlePhone(opts map[string]interface{}) string

HandlePhone handles the boolean map if `gofaker phone` is called

func HandleSSN added in v0.2.0

func HandleSSN(opts map[string]interface{}) (ssn string)

HandleSSN handles the boolean map if `gofaker ssn` is called

func HandleSex

func HandleSex(opts map[string]interface{}) string

HandleSex handles `gofaker sex [--short]`

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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