Skip to main content

TableInfo

Struct TableInfo 

Source
pub struct TableInfo { /* private fields */ }
Expand description

Table information panel for displaying detailed table structure.

Displays a single table’s complete information in a panel format, including columns, indexes, foreign keys, and optional statistics.

Implementations§

Source§

impl TableInfo

Source

pub fn new<S: Into<String>>(name: S, columns: Vec<ColumnData>) -> Self

Create a new table info display.

Source

pub fn empty<S: Into<String>>(name: S) -> Self

Create an empty table info.

Source

pub fn schema<S: Into<String>>(self, schema: S) -> Self

Set the schema name.

Source

pub fn with_primary_key(self, columns: Vec<String>) -> Self

Set the primary key columns.

Source

pub fn add_index(self, index: IndexData) -> Self

Add an index.

Source

pub fn with_indexes(self, indexes: Vec<IndexData>) -> Self

Set all indexes.

Source

pub fn add_foreign_key(self, fk: ForeignKeyData) -> Self

Add a foreign key.

Source

pub fn with_foreign_keys(self, fks: Vec<ForeignKeyData>) -> Self

Set all foreign keys.

Source

pub fn with_stats(self, stats: TableStats) -> Self

Set table statistics.

Source

pub fn theme(self, theme: Theme) -> Self

Set the theme for styled output.

Source

pub fn width(self, width: usize) -> Self

Set the display width.

Source

pub fn show_types(self, show: bool) -> Self

Set whether to show column types.

Source

pub fn show_constraints(self, show: bool) -> Self

Set whether to show constraints.

Source

pub fn full_name(&self) -> String

Get the full table name (schema.table if schema is set).

Source

pub fn render_plain(&self) -> String

Render as plain text for agent consumption.

Source

pub fn render_styled(&self) -> String

Render with ANSI colors for terminal display.

Source

pub fn to_json(&self) -> Value

Convert to JSON representation.

Trait Implementations§

Source§

impl Clone for TableInfo

Source§

fn clone(&self) -> TableInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TableInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.