diff options
author | Marc Coquand <marc@mccd.space> | 2023-12-26 09:02:53 -0600 |
---|---|---|
committer | Marc Coquand <marc@mccd.space> | 2023-12-26 09:57:19 -0600 |
commit | cb124a87d8ed1a309b00c9163cde2911ee029251 (patch) | |
tree | ebb46550ef6236c66ddde5894128ca2e492229df /README.md | |
parent | 5036848184a912a857c4c1e76ef02985295855eb (diff) | |
download | fixgen-cb124a87d8ed1a309b00c9163cde2911ee029251.tar.gz fixgen-cb124a87d8ed1a309b00c9163cde2911ee029251.tar.bz2 fixgen-cb124a87d8ed1a309b00c9163cde2911ee029251.zip |
Add cmdliner
Diffstat (limited to '')
-rw-r--r-- | README.md | 25 |
1 files changed, 18 insertions, 7 deletions
@@ -1,24 +1,35 @@ # (WIP) Fixgen - Language agnostic fixture generator +Usually wiring up fake test data is a bunch of work, especially when that data is relational. Fixgen helps to alleviate some of that pain by allowing you to very easily generate fixtures that can also reference other fixtures. It also has some nice characteristics: + - Zero dependencies - Language agnostic +- Dead simple and fast grammar to generate fixtures in minutes +- Supports relations +- Writing in OCaml -This tool allows you to very easily generate fixtures. +## Usage -You simply define a fixgen file, for example sample.fixgen +Simply define a fixgen file, for example sample.fixgen ``` -user (2): id uuidv4, name name -purchase (10): id uuidv4, buyer user.id, amount int<1,40> +user (2): id uuidv4, name name, email email +purchase (10): id uuidv4, buyer user.id, amount int(1,40) ``` And then run it -``` +```sh $ fixgen sample.fixgen -f csv -o fixtures ``` -And it generates two files: fixtures/purchase.csv, fixtures/user.csv. Bam! Simple as that. +Or just generate in-line: + +```sh +$ fixgen "user (2): id uuidv4, name name; purchase (10): id uuidv4, buyer user.id, amount int<1,40> +``` + +For it to generate two files with fake relational data: fixtures/purchase.csv, fixtures/user.csv. Bam! Simple as that. You can then import it into your SQL server with simple copy from commands @@ -27,7 +38,7 @@ COPY users FROM '/fixtures/user.csv' CSV HEADER; COPY purchases FROM '/fixtures/purchase.csv' CSV HEADER; ``` -Or maybe export as json instead to import into your NoSQL DB. +Or maybe export as JSON instead to import into your NoSQL DB. ## Development - Prerequisites |