table_rex v0.1.0 TableRex.Table

Defines a struct that represents a table and provides functions for working with it

Summary

Functions

Adds a single row to the table

Adds multiple rows to the table

Removes column meta for all columns, effectively resetting column meta back to the default options across the board

Removes all row data from the table, keeping everything else

Retreives the value of a column meta option at the specified col_index. If no value has been set, default values are returned

Returns a boolean detailing if the passed table has a header row set

Returns a boolean detailing if the passed table has any row data set

Creates a new table

Sets cell level information such as alignment

Sets column level information such as padding and alignment

Sets a list as the optional header row. Set to nil or [] to remove an already set header from renders

Sets a string as the optional table title. Set to nil or "" to remove an already set title from renders

Types

t :: %TableRex.Table{columns: term, default_column: term, header_row: term, rows: term, title: term}

Functions

add_row(table, row)

Specs

Adds a single row to the table.

add_rows(table, rows)

Specs

add_rows(TableRex.Table.t, list) :: TableRex.Table.t

Adds multiple rows to the table.

clear_all_column_meta(table)

Specs

clear_all_column_meta(TableRex.Table.t) :: TableRex.Table.t

Removes column meta for all columns, effectively resetting column meta back to the default options across the board.

clear_rows(table)

Specs

Removes all row data from the table, keeping everything else.

get_column_meta(table, col_index, key)

Specs

get_column_meta(TableRex.Table.t, integer, atom) :: any

Retreives the value of a column meta option at the specified col_index. If no value has been set, default values are returned.

has_header?(table)

Specs

has_header?(TableRex.Table.t) :: boolean

Returns a boolean detailing if the passed table has a header row set.

has_rows?(table)

Specs

has_rows?(TableRex.Table.t) :: boolean

Returns a boolean detailing if the passed table has any row data set.

new()

Specs

Creates a new table.

render(table, opts)
render(table, renderer, opts)

Specs

set_cell_meta(table, col_index, row_index, cell_meta)

Specs

set_cell_meta(TableRex.Table.t, integer, integer, Keyword.t) :: TableRex.Table.t

Sets cell level information such as alignment.

set_column_meta(table, col_index, col_meta)

Specs

set_column_meta(TableRex.Table.t, integer | atom, Keyword.t) :: TableRex.Table.t

Sets column level information such as padding and alignment.

set_header(table, header_row)

Specs

set_header(TableRex.Table.t, list | nil) :: TableRex.Table.t

Sets a list as the optional header row. Set to nil or [] to remove an already set header from renders.

set_title(table, title)

Specs

Sets a string as the optional table title. Set to nil or "" to remove an already set title from renders.