Ecto.ERD.Field (Ecto ERD v0.6.5)

View Source

Field struct.

Represents the data for an individual field in Ecto.ERD.Node.

You can update fields on this struct in .ecto_erd.exs if needed.

Summary

Types

A field comment.

t()

Types

comment()

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

A field comment.

Rendering comments is currently supported only by the Mermaid format.

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 that returns documentation about a field
        case DocumentationLib.doc({schema_module, field}) do
          nil ->
            field

          doc ->
            %{field | comment: doc}
        end
      end)
    end
]

t()

@type t() :: %Ecto.ERD.Field{
  comment: comment() | nil,
  name: atom(),
  primary?: boolean(),
  type: atom() | tuple()
}

Functions

new(params)