use super::{DataType, Metadata};
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct Field {
pub name: String,
pub data_type: DataType,
pub is_nullable: bool,
pub metadata: Metadata,
}
impl Field {
pub fn new<T: Into<String>>(name: T, data_type: DataType, is_nullable: bool) -> Self {
Field {
name: name.into(),
data_type,
is_nullable,
metadata: Default::default(),
}
}
#[inline]
pub fn with_metadata(self, metadata: Metadata) -> Self {
Self {
name: self.name,
data_type: self.data_type,
is_nullable: self.is_nullable,
metadata,
}
}
#[inline]
pub fn data_type(&self) -> &DataType {
&self.data_type
}
}