Struct sql_schema_describer::SqlSchema
source · pub struct SqlSchema { /* private fields */ }
Expand description
The result of describing a database schema.
Implementations§
source§impl SqlSchema
impl SqlSchema
sourcepub fn downcast_connector_data<T: 'static>(&self) -> &T
pub fn downcast_connector_data<T: 'static>(&self) -> &T
Extract connector-specific constructs. The type parameter must be the right one.
sourcepub fn next_table_column_id(&self) -> TableColumnId
pub fn next_table_column_id(&self) -> TableColumnId
The id of the next column
sourcepub fn next_view_column_id(&self) -> ViewColumnId
pub fn next_view_column_id(&self) -> ViewColumnId
The id of the next column
sourcepub fn enum_used_in_tables(&self, id: EnumId) -> bool
pub fn enum_used_in_tables(&self, id: EnumId) -> bool
The given enum is used in tables.
sourcepub fn downcast_connector_data_mut<T: 'static>(&mut self) -> &mut T
pub fn downcast_connector_data_mut<T: 'static>(&mut self) -> &mut T
Extract connector-specific constructs mutably. The type parameter must be the right one.
sourcepub fn clear_namespaces(&mut self)
pub fn clear_namespaces(&mut self)
Remove all namespaces from the schema.
sourcepub fn set_connector_data(&mut self, data: Box<dyn Any + Send + Sync>)
pub fn set_connector_data(&mut self, data: Box<dyn Any + Send + Sync>)
Insert connector-specific data into the schema. This will replace existing connector data.
sourcepub fn find_enum(&self, name: &str, namespace: Option<&str>) -> Option<EnumId>
pub fn find_enum(&self, name: &str, namespace: Option<&str>) -> Option<EnumId>
Try to find an enum by name.
sourcepub fn find_table(&self, name: &str, namespace: Option<&str>) -> Option<TableId>
pub fn find_table(&self, name: &str, namespace: Option<&str>) -> Option<TableId>
Try to find a table by name.
sourcepub fn find_view(&self, name: &str, namespace: Option<&str>) -> Option<ViewId>
pub fn find_view(&self, name: &str, namespace: Option<&str>) -> Option<ViewId>
Try to find a table by name.
sourcepub fn get_procedure(&self, name: &str) -> Option<&Procedure>
pub fn get_procedure(&self, name: &str) -> Option<&Procedure>
Get a procedure.
sourcepub fn get_user_defined_type(&self, name: &str) -> Option<&UserDefinedType>
pub fn get_user_defined_type(&self, name: &str) -> Option<&UserDefinedType>
Get a user defined type by name.
sourcepub fn get_namespace_id(&self, name: &str) -> Option<NamespaceId>
pub fn get_namespace_id(&self, name: &str) -> Option<NamespaceId>
Find a namespace by name.
sourcepub fn indexes_count(&self) -> usize
pub fn indexes_count(&self) -> usize
The total number of indexes in the schema.
sourcepub fn make_fulltext_indexes_normal(&mut self)
pub fn make_fulltext_indexes_normal(&mut self)
Make all fulltext indexes non-fulltext, for the preview feature’s purpose.
sourcepub fn push_table_column(
&mut self,
table_id: TableId,
column: Column
) -> TableColumnId
pub fn push_table_column( &mut self, table_id: TableId, column: Column ) -> TableColumnId
Add a table column to the schema.
sourcepub fn push_view_column(
&mut self,
view_id: ViewId,
column: Column
) -> ViewColumnId
pub fn push_view_column( &mut self, view_id: ViewId, column: Column ) -> ViewColumnId
Add a view column to the schema.
sourcepub fn push_enum(
&mut self,
namespace_id: NamespaceId,
enum_name: String,
description: Option<String>
) -> EnumId
pub fn push_enum( &mut self, namespace_id: NamespaceId, enum_name: String, description: Option<String> ) -> EnumId
Add an enum to the schema.
sourcepub fn push_enum_variant(
&mut self,
enum_id: EnumId,
variant_name: String
) -> EnumVariantId
pub fn push_enum_variant( &mut self, enum_id: EnumId, variant_name: String ) -> EnumVariantId
Add a variant to an enum.
sourcepub fn push_fulltext_index(
&mut self,
table_id: TableId,
index_name: String
) -> IndexId
pub fn push_fulltext_index( &mut self, table_id: TableId, index_name: String ) -> IndexId
Add a fulltext index to the schema.
sourcepub fn push_index(&mut self, table_id: TableId, index_name: String) -> IndexId
pub fn push_index(&mut self, table_id: TableId, index_name: String) -> IndexId
Add an index to the schema.
sourcepub fn push_table_default_value(
&mut self,
column_id: TableColumnId,
value: DefaultValue
) -> TableDefaultValueId
pub fn push_table_default_value( &mut self, column_id: TableColumnId, value: DefaultValue ) -> TableDefaultValueId
Add table default value to the schema.
sourcepub fn push_view_default_value(
&mut self,
column_id: ViewColumnId,
value: DefaultValue
) -> ViewDefaultValueId
pub fn push_view_default_value( &mut self, column_id: ViewColumnId, value: DefaultValue ) -> ViewDefaultValueId
Add table default value to the schema.
sourcepub fn push_primary_key(
&mut self,
table_id: TableId,
index_name: String
) -> IndexId
pub fn push_primary_key( &mut self, table_id: TableId, index_name: String ) -> IndexId
Add a primary key to the schema.
sourcepub fn push_unique_constraint(
&mut self,
table_id: TableId,
index_name: String
) -> IndexId
pub fn push_unique_constraint( &mut self, table_id: TableId, index_name: String ) -> IndexId
Add a unique constraint/index to the schema.
pub fn push_index_column(&mut self, column: IndexColumn) -> IndexColumnId
pub fn push_foreign_key( &mut self, constraint_name: Option<String>, [constrained_table, referenced_table]: [TableId; 2], [on_delete_action, on_update_action]: [ForeignKeyAction; 2] ) -> ForeignKeyId
pub fn push_foreign_key_column( &mut self, foreign_key_id: ForeignKeyId, [constrained_column, referenced_column]: [TableColumnId; 2] )
pub fn push_namespace(&mut self, name: String) -> NamespaceId
pub fn push_table( &mut self, name: String, namespace_id: NamespaceId, description: Option<String> ) -> TableId
pub fn push_view( &mut self, name: String, namespace_id: NamespaceId, definition: Option<String>, description: Option<String> ) -> ViewId
pub fn push_table_with_properties( &mut self, name: String, namespace_id: NamespaceId, properties: BitFlags<TableProperties>, description: Option<String> ) -> TableId
pub fn namespaces_count(&self) -> usize
pub fn namespace_walker<'a>(&'a self, name: &str) -> Option<NamespaceWalker<'a>>
pub fn tables_count(&self) -> usize
pub fn views_count(&self) -> usize
pub fn table_walker<'a>(&'a self, name: &str) -> Option<TableWalker<'a>>
pub fn table_walker_ns<'a>( &'a self, namespace: &str, name: &str ) -> Option<TableWalker<'a>>
pub fn view_walker<'a>(&'a self, name: &str) -> Option<ViewWalker<'a>>
pub fn view_walker_ns<'a>( &'a self, namespace: &str, name: &str ) -> Option<ViewWalker<'a>>
pub fn table_walkers(&self) -> impl ExactSizeIterator<Item = TableWalker<'_>>
pub fn view_walkers(&self) -> impl ExactSizeIterator<Item = ViewWalker<'_>>
pub fn udt_walkers(&self) -> impl Iterator<Item = UserDefinedTypeWalker<'_>>
pub fn enum_walkers(&self) -> impl ExactSizeIterator<Item = EnumWalker<'_>>
pub fn walk_foreign_keys(&self) -> impl Iterator<Item = ForeignKeyWalker<'_>>
sourcepub fn walk_table_columns(&self) -> impl Iterator<Item = TableColumnWalker<'_>>
pub fn walk_table_columns(&self) -> impl Iterator<Item = TableColumnWalker<'_>>
Traverse all the table columns in the schema.
sourcepub fn walk_view_columns(&self) -> impl Iterator<Item = ViewColumnWalker<'_>>
pub fn walk_view_columns(&self) -> impl Iterator<Item = ViewColumnWalker<'_>>
Traverse all the table columns in the schema.
sourcepub fn walk_namespaces(
&self
) -> impl ExactSizeIterator<Item = NamespaceWalker<'_>>
pub fn walk_namespaces( &self ) -> impl ExactSizeIterator<Item = NamespaceWalker<'_>>
Traverse all namespaces in the catalog.
Trait Implementations§
source§impl<'de> Deserialize<'de> for SqlSchema
impl<'de> Deserialize<'de> for SqlSchema
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Auto Trait Implementations§
impl !RefUnwindSafe for SqlSchema
impl Send for SqlSchema
impl Sync for SqlSchema
impl Unpin for SqlSchema
impl !UnwindSafe for SqlSchema
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_mut()
into the pipe
function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds.