pub trait ExprHumanizer: Debug {
// Required methods
fn humanize_id(&self, id: GlobalId) -> Option<String>;
fn humanize_id_unqualified(&self, id: GlobalId) -> Option<String>;
fn humanize_id_parts(&self, id: GlobalId) -> Option<Vec<String>>;
fn humanize_scalar_type(
&self,
ty: &ScalarType,
postgres_compat: bool,
) -> String;
fn column_names_for_id(&self, id: GlobalId) -> Option<Vec<String>>;
fn humanize_column(&self, id: GlobalId, column: usize) -> Option<String>;
fn id_exists(&self, id: GlobalId) -> bool;
// Provided method
fn humanize_column_type(
&self,
typ: &ColumnType,
postgres_compat: bool,
) -> String { ... }
}
Expand description
A trait for humanizing components of an expression.
This will be most often used as part of the rendering context
type for various Display$Format
implementation.
Required Methods§
Sourcefn humanize_id(&self, id: GlobalId) -> Option<String>
fn humanize_id(&self, id: GlobalId) -> Option<String>
Attempts to return a human-readable string for the relation
identified by id
.
Sourcefn humanize_id_unqualified(&self, id: GlobalId) -> Option<String>
fn humanize_id_unqualified(&self, id: GlobalId) -> Option<String>
Same as above, but without qualifications, e.g., only foo
for materialize.public.foo
.
Sourcefn humanize_id_parts(&self, id: GlobalId) -> Option<Vec<String>>
fn humanize_id_parts(&self, id: GlobalId) -> Option<Vec<String>>
Like Self::humanize_id
, but returns the constituent parts of the
name as individual elements.
Sourcefn humanize_scalar_type(&self, ty: &ScalarType, postgres_compat: bool) -> String
fn humanize_scalar_type(&self, ty: &ScalarType, postgres_compat: bool) -> String
Returns a human-readable name for the specified scalar type.
Used in, e.g., EXPLAIN and error msgs, in which case exact Postgres compatibility is less
important than showing as much detail as possible. Also used in pg_typeof
, where Postgres
compatibility is more important.
Sourcefn column_names_for_id(&self, id: GlobalId) -> Option<Vec<String>>
fn column_names_for_id(&self, id: GlobalId) -> Option<Vec<String>>
Returns a vector of column names for the relation identified by id
.
Provided Methods§
Sourcefn humanize_column_type(
&self,
typ: &ColumnType,
postgres_compat: bool,
) -> String
fn humanize_column_type( &self, typ: &ColumnType, postgres_compat: bool, ) -> String
Returns a human-readable name for the specified column type.
Used in, e.g., EXPLAIN and error msgs, in which case exact Postgres compatibility is less
important than showing as much detail as possible. Also used in pg_typeof
, where Postgres
compatibility is more important.