Exdot.ERD (exdot v0.1.0) View Source
Simple DSL-ish template or creating Entity-Replationship Diagram. Inspired by ERD. It produces the dot-file which looks similar to ERD.
er_diagram do
entity(
"Students",
[
{"id", [:varchar, :not_null, :pk]},
{"name", [:varchar, :not_null]},
{"DOB", [:date_time, :not_null]},
{"phone", [:varchar]},
{"address", [:text]},
{"college_id", [:varchar, :not_null, :fk]}
],
"#d0e0d0"
)
entity(
"Colleges",
[
{"id", [:varchar, :not_null, :pk]},
{"name", [:text, :not_null]},
{"address", [:text]}
],
"#ececfc"
)
relation("Students:id", "Colleges:id", "1..N", "1")
end
Link to this section Summary
Functions
Creates graphviz node for Entity.
Creates Graphviz digraph block similar to Exdot.digraph
but with a predefined template.
Creates graphviz edge for the relationship between entities.
Link to this section Types
Specs
field_name() :: String.t()
Specs
fields() :: [{field_name(), attributes :: [atom()]}]
Link to this section Functions
Specs
entity(String.t(), fields(), String.t()) :: Exdot.expr()
Creates graphviz node for Entity.
entity(
"Colleges",
[
{"id", [:varchar, :not_null, :pk]},
{"name", [:text, :not_null]},
{"address", [:text]}
],
"#ececfc"
)
Specs
er_diagram(String.t(), do_block :: [Exdot.expr()]) :: String.t()
Creates Graphviz digraph block similar to Exdot.digraph
but with a predefined template.
Specs
relation(String.t(), String.t(), String.t(), String.t()) :: Exdot.expr()
Creates graphviz edge for the relationship between entities.
relation("Students:id", "Colleges:id", "1..N", "1")