FrameworkUpdated
Elixir Test Data Generation with MockHero
Client
defmodule MockHero do
def generate(tables, seed \\ nil) do
body = %{tables: tables}
body = if seed, do: Map.put(body, :seed, seed), else: body
Req.post!("https://api.mockhero.dev/api/v1/generate",
json: body,
headers: [
{"x-api-key", System.get_env("MOCKHERO_API_KEY")}
]
).body
end
end
data = MockHero.generate([
%{name: "users", count: 50, fields: [
%{name: "id", type: "uuid"},
%{name: "email", type: "email"}
]},
%{name: "posts", count: 200, fields: [
%{name: "id", type: "uuid"},
%{name: "user_id", type: "ref", ref: "users.id"},
%{name: "title", type: "sentence"}
]}
], 42)
Get Started
D
Founder of MockHero. Writes about synthetic test data, agent workflows, and database seeding with MockHero.
Start generating test data for free
500 records/day on the free tier. No credit card required.
Get Your API Key