use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DatasetColumn {
order: Option<f32>,
name: Option<String>,
#[serde(rename = "type")]
field_type: Option<String>,
#[serde(rename = "originalType")]
original_type: Option<String>,
description: Option<String>,
}
impl DatasetColumn {
pub fn new(name: impl ToString) -> Self {
Self {
name: Some(name.to_string()),
..Default::default()
}
}
pub fn set_order(&mut self, order: f32) {
self.order = Some(order);
}
pub fn with_order(mut self, order: f32) -> DatasetColumn {
self.order = Some(order);
self
}
pub fn order(&self) -> Option<&f32> {
self.order.as_ref()
}
pub fn reset_order(&mut self) {
self.order = None;
}
pub fn set_name(&mut self, name: String) {
self.name = Some(name);
}
pub fn with_name(mut self, name: String) -> DatasetColumn {
self.name = Some(name);
self
}
pub fn name(&self) -> Option<&String> {
self.name.as_ref()
}
pub fn reset_name(&mut self) {
self.name = None;
}
pub fn set_type(&mut self, _type: String) {
self.field_type = Some(_type);
}
pub fn with_type(mut self, _type: String) -> DatasetColumn {
self.field_type = Some(_type);
self
}
pub fn get_type(&self) -> Option<&String> {
self.field_type.as_ref()
}
pub fn reset_type(&mut self) {
self.field_type = None;
}
pub fn set_original_type(&mut self, original_type: String) {
self.original_type = Some(original_type);
}
pub fn with_original_type(mut self, original_type: String) -> DatasetColumn {
self.original_type = Some(original_type);
self
}
pub fn original_type(&self) -> Option<&String> {
self.original_type.as_ref()
}
pub fn reset_original_type(&mut self) {
self.original_type = None;
}
pub fn set_description(&mut self, description: String) {
self.description = Some(description);
}
pub fn with_description(mut self, description: String) -> DatasetColumn {
self.description = Some(description);
self
}
pub fn description(&self) -> Option<&String> {
self.description.as_ref()
}
pub fn reset_description(&mut self) {
self.description = None;
}
}