View Source Ecto.ERD.Field (Ecto ERD v0.6.2)

Field struct

Represents data of an individual field in Ecto.ERD.Node.

Feel free to update fields of this struct in .ecto_erd.exs if needed.

Summary

Types

A field comment.

t()

Types

@type comment() :: String.t()

A field comment.

Rendering of comments is supported only by Mermaid format at the moment.

Example

# File: .ecto_erd.exs
[
  map_node: fn
    %Ecto.ERD.Node{schema_module: schema_module} = node ->
      update_in(node, [Access.key(:fields), Access.all()], fn field ->
        # `DocumentationLib` is a fictional module returning documentation about a field
        case DocumentationLib.doc({schema_module, field})  do
          nil ->
            field

          doc ->
            %{field | comment: doc}
        end
      end)
    end
]
@type t() :: %Ecto.ERD.Field{
  comment: comment() | nil,
  name: atom(),
  primary?: boolean(),
  type: atom() | tuple()
}

Functions