diff --git a/src/helpers/database.rs b/src/helpers/database.rs index 25e29c3..b083dc0 100644 --- a/src/helpers/database.rs +++ b/src/helpers/database.rs @@ -139,11 +139,16 @@ impl<'a> RowResult<'a> { } } - /// Get an optional string => Set to None if string is null + /// Get an optional string => Set to None if string is null / empty pub fn get_optional_str(&self, name: &str) -> ResultBoxError> { match self.is_null(name)? { true => Ok(None), - false => Ok(Some(self.get_str(name)?)) + false => Ok(Some(self.get_str(name)?).map_or(None, |d|{ + match d.is_empty() { + true => None, + false => Some(d) + } + })) } } }