View Source TableRex.Renderer behaviour (table_rex v4.1.0)

An Elixir behaviour that defines the API Renderers should conform to, allowing for display output in a variety of formats.

Summary

Types

Return value of the render function.

Callbacks

Returns a Map of the options and their default values required by the renderer.

Renders a passed %TableRex.Table{} struct into a string.

Types

@type render_return() :: {:ok, String.t()} | {:error, String.t()}

Return value of the render function.

Callbacks

@callback default_options() :: map()

Returns a Map of the options and their default values required by the renderer.

@callback render(
  table :: %TableRex.Table{
    columns: term(),
    default_column: term(),
    header_row: term(),
    rows: term(),
    title: term()
  },
  opts :: list()
) :: render_return()

Renders a passed %TableRex.Table{} struct into a string.