forked from launchbadge/sqlx
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mysql(chrono): support decoding ZERO_DATES
mysql: refactor to a generic MysqlZeroDate enum mysql: test MysqlZeroDate
- Loading branch information
1 parent
e4005bb
commit 4ca50b9
Showing
4 changed files
with
223 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#[derive(Debug, PartialEq)] | ||
pub enum MysqlZeroDate<T> { | ||
Zero, | ||
NotZero(T) | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
struct ZeroDateError; | ||
|
||
impl std::fmt::Display for ZeroDateError { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "Unexpected ZERO_DATE encountered!") | ||
} | ||
} | ||
|
||
impl std::error::Error for ZeroDateError {} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters