pub struct Column {
pub name: String,
pub description: Option<String>,
pub nullable: bool,
pub data_type: String,
pub nominal_type: String,
pub domain_type: Option<String>,
pub max_len: Option<i32>,
pub default: Option<String>,
pub enum_values: Vec<String>,
pub is_pk: bool,
pub position: i32,
pub always_generated: bool,
}Expand description
A table column.
Fields§
§name: StringColumn name
description: Option<String>Description from comment
nullable: boolWhether NULL is allowed
data_type: StringPostgreSQL data type
nominal_type: StringBase type (for domains)
domain_type: Option<String>The domain this column is declared over, where it is declared over one.
information_schema reports the type underneath a domain in
data_type and udt_name, so nothing else says that a value is a
color rather than an integer – and a data representation is declared
on the domain.
max_len: Option<i32>Maximum length (for varchar, etc.)
default: Option<String>Default value expression
enum_values: Vec<String>Enum values (for enum types)
is_pk: boolWhether this is part of the primary key
position: i32Column position (1-based)
always_generated: boolWhether PostgreSQL generates this column’s value and refuses any other.
GENERATED ALWAYS AS IDENTITY and GENERATED ALWAYS AS (...) STORED
both mean the same thing to a writer: naming the column at all is an
error, not merely unnecessary. A BY DEFAULT identity is not this –
it has a default and accepts a value – which is why the flag is about
what a write may say rather than about how a value is produced.
Implementations§
Source§impl Column
impl Column
Sourcepub fn representation_type(&self) -> &str
pub fn representation_type(&self) -> &str
The type a data representation would be declared on.
The domain where the column has one, and the type itself otherwise.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Column
impl<'de> Deserialize<'de> for Column
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 Freeze for Column
impl RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl UnsafeUnpin for Column
impl UnwindSafe for Column
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more