2023-04-28 06:08:53 +00:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! impl_into_field_type {
|
|
|
|
($target: ident) => {
|
|
|
|
impl std::convert::From<$target> for FieldType {
|
|
|
|
fn from(ty: $target) -> Self {
|
|
|
|
match ty {
|
|
|
|
0 => FieldType::RichText,
|
|
|
|
1 => FieldType::Number,
|
|
|
|
2 => FieldType::DateTime,
|
|
|
|
3 => FieldType::SingleSelect,
|
|
|
|
4 => FieldType::MultiSelect,
|
|
|
|
5 => FieldType::Checkbox,
|
|
|
|
6 => FieldType::URL,
|
|
|
|
7 => FieldType::Checklist,
|
2023-05-31 09:34:41 +00:00
|
|
|
8 => FieldType::LastEditedTime,
|
|
|
|
9 => FieldType::CreatedTime,
|
2023-04-28 06:08:53 +00:00
|
|
|
_ => {
|
2023-07-14 05:37:13 +00:00
|
|
|
tracing::error!("🔴Can't parser FieldType from value: {}", ty);
|
2023-04-28 06:08:53 +00:00
|
|
|
FieldType::RichText
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2023-08-27 14:31:32 +00:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! impl_into_field_visibility {
|
|
|
|
($target: ident) => {
|
|
|
|
impl std::convert::From<$target> for FieldVisibility {
|
|
|
|
fn from(ty: $target) -> Self {
|
|
|
|
match ty {
|
|
|
|
0 => FieldVisibility::AlwaysShown,
|
|
|
|
1 => FieldVisibility::HideWhenEmpty,
|
|
|
|
2 => FieldVisibility::AlwaysHidden,
|
|
|
|
_ => {
|
|
|
|
tracing::error!("🔴Can't parser FieldVisibility from value: {}", ty);
|
|
|
|
FieldVisibility::AlwaysShown
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|