Relying on brianvoe/gofakeit, Charlatan allows you to create a ton of fixtures/fake data for use while developing or testing your project. It is inspired by nelmio/alice.It gives you a few essential tools to make it very easy to generate complex data in a readable and easy to edit way, so that everyone on your team can tweak the fixtures if needed.
First, get it:
go get -u github.com/guiyomh/charlatan
Here is a complete example of a declaration:
user:
user_tpl (template):
first_name: '{firstname}'
last_name: '{lastname}'
pseudo: '{username}'
password: '{words:2,true}'
email : '{email}'
admin_1:
first_name: 'William'
last_name: 'Wallace'
pseudo: 'WW'
password: 'freedommmmmmm'
email : 'freedom@gouv.co.uk'
isAdmin: true
admin_{2..5} (extends user_tpl):
isAdmin: true
user_{bob,harry,george} (extends user_tpl):
isAdmin: false
You can then load them easily with:
charlatan load --fixtures ./fixtures --user=<your_db_user> --dbname=<your_dbname> --pass=<your_db_pass>
- MySQL / MariaDB
- PostgreSQL (in progress)