use serde_derive::{Serialize};
+#[derive(Default, Clone, Copy)]
+pub enum FieldDbType {
+ #[default]
+ Text,
+ Integer,
+ Float,
+ Date,
+ DateTime,
+}
+
#[derive(Default)]
struct Field {
name: String,
to_load: bool,
to_save: bool,
to_render: bool,
+ db_type: FieldDbType,
tmpl: tera::Tera,
filters: Vec<super::filters::Filter>,
}
fn get_to_render(&self) -> bool;
fn set_to_render(&mut self, to_render: bool);
+ fn get_db_type(&self) -> FieldDbType;
+ fn set_db_type(&mut self, db_type: FieldDbType);
+
fn add_filter(&mut self, filter: super::filters::Filter);
fn filter(&mut self);
self.field.to_render = render;
}
+ fn get_db_type(&self) -> FieldDbType {
+ self.field.db_type
+ }
+
+ fn set_db_type(&mut self, db_type: FieldDbType) {
+ self.field.db_type = db_type;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
self.field.to_render = render;
}
+ fn get_db_type(&self) -> FieldDbType {
+ self.field.db_type
+ }
+
+ fn set_db_type(&mut self, db_type: FieldDbType) {
+ self.field.db_type = db_type;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
self.field.to_render = render;
}
+ fn get_db_type(&self) -> FieldDbType {
+ self.field.db_type
+ }
+
+ fn set_db_type(&mut self, db_type: FieldDbType) {
+ self.field.db_type = db_type;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
self.field.to_render = render;
}
+ fn get_db_type(&self) -> FieldDbType {
+ self.field.db_type
+ }
+
+ fn set_db_type(&mut self, db_type: FieldDbType) {
+ self.field.db_type = db_type;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
self.field.to_render = render;
}
+ fn get_db_type(&self) -> FieldDbType {
+ self.field.db_type
+ }
+
+ fn set_db_type(&mut self, db_type: FieldDbType) {
+ self.field.db_type = db_type;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
self.field.to_render = render;
}
+ fn get_db_type(&self) -> FieldDbType {
+ self.field.db_type
+ }
+
+ fn set_db_type(&mut self, db_type: FieldDbType) {
+ self.field.db_type = db_type;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}