pub struct ColumnDescription {
pub name: Vec<SqlChar>,
pub data_type: DataType,
pub nullability: Nullability,
}
Expand description
Describes the type and attributes of a column.
Fields§
§name: Vec<SqlChar>
Column name. May be empty if unavailable.
data_type: DataType
Type of the column
nullability: Nullability
Indicates whether the column is nullable or not.
Implementations§
Source§impl ColumnDescription
impl ColumnDescription
Sourcepub fn new(name: &str, data_type: DataType, nullability: Nullability) -> Self
pub fn new(name: &str, data_type: DataType, nullability: Nullability) -> Self
In production, an ‘empty’ ColumnDescription
is expected to be constructed via the
Default
trait. It is then filled using crate::ResultSetMetadata::describe_col
. When
writing test cases however it might be desirable to directly instantiate a
ColumnDescription
. This constructor enables you to do that, without caring which type
SqlChar
resolves to.
Sourcepub fn name_to_string(&self) -> Result<String, FromUtf8Error>
pub fn name_to_string(&self) -> Result<String, FromUtf8Error>
Converts the internal UTF16 representation of the column name into UTF8 and returns the
result as a String
.
Sourcepub fn could_be_nullable(&self) -> bool
pub fn could_be_nullable(&self) -> bool
true
if the column is Nullable
or it is not know whether the column is nullable. false
if and only if the column is NoNulls
.
Trait Implementations§
Source§impl Clone for ColumnDescription
impl Clone for ColumnDescription
Source§fn clone(&self) -> ColumnDescription
fn clone(&self) -> ColumnDescription
Returns a copy of the value. Read more
1.0.0 · 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 ColumnDescription
impl Debug for ColumnDescription
Source§impl Default for ColumnDescription
impl Default for ColumnDescription
Source§fn default() -> ColumnDescription
fn default() -> ColumnDescription
Returns the “default value” for a type. Read more
Source§impl PartialEq for ColumnDescription
impl PartialEq for ColumnDescription
impl Eq for ColumnDescription
impl StructuralPartialEq for ColumnDescription
Auto Trait Implementations§
impl Freeze for ColumnDescription
impl RefUnwindSafe for ColumnDescription
impl Send for ColumnDescription
impl Sync for ColumnDescription
impl Unpin for ColumnDescription
impl UnwindSafe for ColumnDescription
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