Closed zachdaniel closed 2 years ago
@zachdaniel yep, that's a valid point!
The easiest way is probably something like this:
map(boolean(), fn _ ā Ecto.UUID.generate() end)
which is very similar to what you show above. Iām open to having something like StreamData.from_stream/1
though? It would be an unshrinkable generator that takes any stream and converts it to a StreamData generator. With that, you could implement the UUID as:
&Ecto.UUID.generate/0
|> Stream.repeatedly()
|> StreamData.from_stream()
Thoughts?
I think StreamData.from_stream/1
being unshrinkable may be a bit of a footgun, and that perhaps we should add something smaller like StreamData.repeatedly/1
?
@zachdaniel Iām ok to start with StreamData.repeatedly/1
. Wanna go for a PR? š
Absolutely :)
I can't seem to find a way to make a simple generator for something like
&Ecto.UUID.generate/0
. Per #38,bind/2
works I think because the inner generator is recreated each time, so my best guess on implementing that generator is currentlyIt seems strange to have to build off of another generator for no good reason there.
This doesn't work, as naturally the list simply repeats the generated uuid.