diff options
-rw-r--r-- | README.md | 24 | ||||
-rw-r--r-- | dune-project | 3 | ||||
-rw-r--r-- | fixgen.opam | 3 |
3 files changed, 22 insertions, 8 deletions
@@ -8,12 +8,16 @@ Usually wiring up fake test data is a bunch of work, especially when that data i - Supports relations - Written in OCaml +## Install + +Copy the binary to `/usr/local/bin` + ## Usage Fixgen makes it simple to generate fixtures. It comes with a tiny DSL: ```sh -$ fixgen 'user (2): id uuidv4, name name; purchase (10): id uuidv4, buyer user.id, amount int<1,40>, currency: ("USD","MXN")' -o fixtures +$ fixgen 'user (2): id uuidv4, name name; purchase (10): id uuidv4, buyer user.id, amount int(1,40), currency: ("USD","MXN")' -o fixtures ``` This will generate two files: @@ -31,11 +35,21 @@ COPY purchases FROM '/fixtures/purchase.csv' CSV HEADER; Or maybe export as JSON instead to import into your NoSQL DB. ```sh -$ fixgen 'user (2): id uuidv4, name name; purchase (3): id uuidv4, buyer user.id, amount int<1,40>, currency: ("USD","MXN")' -f json +$ fixgen 'user (2): id uuidv4, name name; purchase (3): id uuidv4, buyer user.id, amount int(1,40), currency: ("USD","MXN")' -f json ``` This will print two JSON arrays to stdout. +### Supported types + +Fixgen comes with the following built-in types: + +- name +- uuidv4 +- int(min,max) +- constant, defined in quotes - `fixgen 'user (1): id uuiv4, name "Bob"'` +- ("multiple","choices") + ## Development - Prerequisites - [Nix](https://nixos.org/manual/nix/stable/installation/installing-binary) @@ -86,3 +100,9 @@ dune runtests ``` dune build ``` + +### Contributing + +[Mailing list](https://lists.sr.ht/~marcc/public-inbox). + +Send your patches via [mail](mailto:~marcc/fixgen@lists.sr.ht). New to mailing patches? Check out this [tutorial](https://git-send-email.io/). diff --git a/dune-project b/dune-project index 5676cf0..6b155aa 100644 --- a/dune-project +++ b/dune-project @@ -4,9 +4,6 @@ (generate_opam_files true) -(source - (github username/reponame)) - (authors "Marc Coquand") (maintainers "Marc Coquand") diff --git a/fixgen.opam b/fixgen.opam index 338965e..988b773 100644 --- a/fixgen.opam +++ b/fixgen.opam @@ -5,9 +5,7 @@ description: "Generate fixtures for testing" maintainer: ["Marc Coquand"] authors: ["Marc Coquand"] license: "AGPL-3.0-only" -homepage: "https://github.com/username/reponame" doc: "https://url/to/documentation" -bug-reports: "https://github.com/username/reponame/issues" depends: [ "ocaml" "dune" {>= "3.11"} @@ -32,4 +30,3 @@ build: [ "@doc" {with-doc} ] ] -dev-repo: "git+https://github.com/username/reponame.git" |