Dependent Entities
(ns fab.tutorial
(:require [fabrikk.alpha.core :as fab]))
(defn admin-email []
(str "admin-" (rand-int 10000) "@example.com"))
(def user
(fab/->factory
::user
{:template {:id (fab/sequence)
:name "John Smith"
:email "john@example.org"
:role "user"
:verified true}
:traits {:admin {:email admin-email
:role "admin"}
:unverified {:verified false}}}))
(def post
(fab/->factory
::post
{:template {:id random-uuid
:title "This one weird trick"
:content "Some content goes here...."
:author (fab/one ::user)}}))Last updated