pub struct ResultSchema { /* private fields */ }Expand description
Schema information for a query result.
Provides metadata about the columns returned by a query, including column names and types.
Implementations§
Source§impl ResultSchema
impl ResultSchema
Sourcepub fn from_columns(columns: Vec<ResultColumn>) -> Self
pub fn from_columns(columns: Vec<ResultColumn>) -> Self
Creates a result schema from column definitions.
Sourcepub fn add_column(&mut self, name: impl Into<String>, sql_type: SqlType)
pub fn add_column(&mut self, name: impl Into<String>, sql_type: SqlType)
Adds a column to the schema.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Returns the number of columns.
Sourcepub fn columns(&self) -> &[ResultColumn]
pub fn columns(&self) -> &[ResultColumn]
Returns all columns.
Sourcepub fn column(&self, index: usize) -> &ResultColumn
pub fn column(&self, index: usize) -> &ResultColumn
Sourcepub fn column_by_name(&self, name: &str) -> Option<&ResultColumn>
pub fn column_by_name(&self, name: &str) -> Option<&ResultColumn>
Returns the column with the given name, if it exists.
Sourcepub fn column_index(&self, name: &str) -> Option<usize>
pub fn column_index(&self, name: &str) -> Option<usize>
Returns the index of the column with the given name, if it exists.
Trait Implementations§
Source§impl Clone for ResultSchema
impl Clone for ResultSchema
Source§fn clone(&self) -> ResultSchema
fn clone(&self) -> ResultSchema
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResultSchema
impl Debug for ResultSchema
Source§impl Default for ResultSchema
impl Default for ResultSchema
Source§fn default() -> ResultSchema
fn default() -> ResultSchema
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ResultSchema
impl RefUnwindSafe for ResultSchema
impl Send for ResultSchema
impl Sync for ResultSchema
impl Unpin for ResultSchema
impl UnsafeUnpin for ResultSchema
impl UnwindSafe for ResultSchema
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request