Built on top of #43 and for that reason I'm opening the PR against that branch. So that understanding what I've done in the context of this one is easier to read.
There are a few unrelated changes that create some noise (renaming, some gardening) so let me explain what's the core of this change.
Before this change, fakedata would do the following:
Take all the args from the CLI
return an array of columns
For each row:
parse the options of each arg
generate a value based on the constraint
This change affects the algorithm so that we do parsing of the options only once. After the change:
Take all the args from the CLI
Parse options for each arg
Return a column with its own Generator embedded (that's the key change)
For each row:
generate a value using the "column generator"
It's a lot of changes but I believe it leads to better design. The two pass-algorithm removes the need for caches (like the fileCache we introduced in the file generator) and opens the door to any optimization we'd like to do in the future (in case it's needed).
I introduced a private factory too, as a consequence of this conversation which removed the init func we have.
Built on top of #43 and for that reason I'm opening the PR against that branch. So that understanding what I've done in the context of this one is easier to read.
There are a few unrelated changes that create some noise (renaming, some gardening) so let me explain what's the core of this change.
Before this change,
fakedata
would do the following:This change affects the algorithm so that we do parsing of the options only once. After the change:
It's a lot of changes but I believe it leads to better design. The two pass-algorithm removes the need for caches (like the fileCache we introduced in the file generator) and opens the door to any optimization we'd like to do in the future (in case it's needed).
I introduced a private factory too, as a consequence of this conversation which removed the init func we have.