1#[macro_export]
2macro_rules! impl_from_str {
3 ($struct_name:ident, $match_str:expr) => {
4 impl std::str::FromStr for $struct_name {
5 type Err = SqliteError;
6
7 fn from_str(s: &str) -> Result<Self, Self::Err> {
8 match s {
9 $match_str => Ok(Self),
10 _ => Err(SqliteError::SqlParser(SqlParserError(format!(
11 "Error on parsing {}",
12 Self::NAME,
13 )))),
14 }
15 }
16 }
17 };
18}
19
20#[macro_export]
21macro_rules! field_parsing_error {
22 ($entity_name:expr) => {
23 $crate::result::SqliteError::ParsingField($crate::result::FieldParsingError(format!(
24 "Invalid payload for {}",
25 Self::NAME
26 )))
27 };
28}
29
30