Faker Generator

The faker command generates data using Datafaker.

riotx faker [OPTIONS] FIELD... [REDIS COMMAND...]

where FIELD is a Faker field in the form field="expression".

To show the full usage, run:

riotx faker --help

You must specify at least one Redis command as a target.

Redis connection options apply to the root command (riotx) and not to subcommands.

In this example the Redis options will not be taken into account:

riotx faker id="numerify('####')" hset -h myredis.com -p 6380

Use index to access the current record count. You can for example do this:

riotx faker text="lorem.words(2)" id="index" hset test:#{id}"

Keys

Keys are constructed from input records by concatenating the keyspace prefix and key fields.

mapping
Import into hashes
riotx faker id="numerify('##########')" firstName="name.firstName" lastName="name.lastName" address="address.fullAddress" hset person:#{id}
Import into sets
riotx faker name="gameOfThrones.character" --count 1000 sadd got:characters --member "#{name}"

Data Providers

Faker offers many data providers. Most providers don’t take any arguments and can be called directly:

Simple Faker example
riotx faker firstName="name.firstName"

Some providers take parameters:

Parameter Faker example
riotx faker lease="number.digits(2)"

Here are a few sample Faker expressions:

  • regexify('(a|b){2,3}')

  • regexify('\\.\\*\\?\\+')

  • bothify('????',false)

  • name.firstName

  • name.lastName

  • number.numbeBbetween(1,10)